docker官方教程笔记

一、Getting Started

docker run -dp 80:80 docker/getting-started
  • -d- run the container in detached mode (in the background)
  • -p 80:80- map port 80 of the host to port 80 in the container
  • docker/getting-started - the image to use

You can combine single character flags to shorten the full command. As an example, the command above could be written as:

docker run -dp 80:80 docker /getting-started

二、Our Application

1. Download the ZIP
2. Building the App’s Container Image
  • Create a field named Dockerfile
FROM node:12-alpine
RUN apk add --no-cache python g++ make
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "src/index.js"]
  • docker build
docker build -t getting-restarted .
3. Starting an App Container
docker run -dp 3000:3000 getting-started

三、Updating our App

1. Updating our docker image
  • update code
  • update version of the image:docker build -t getting-started
2. Removing a container using the CLI
  • Get the ID of the container
    docker ps
    
  • Use
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值