[wip]docker基础
创建: 2020/04/09
| Docker容器的设计 | |||||||||||||||||||||
| 一个容器一个进程 | |||||||||||||||||||||
| immutable infrastructure的image | build后不依赖外部资源 | ||||||||||||||||||||
| 轻量化的Docker image | |||||||||||||||||||||
| 运行用户不作为作为root用户 | |||||||||||||||||||||
| Dockerfile的写法 | |||||||||||||||||||||
| 基本命令 |
|
||||||||||||||||||||
| 例 |
Dockerfile的基本流程: FROM获取base image 使用其他命令配置环境完成image的创建 # https://hub.docker.com/_/rails FROM ruby:2.3 RUN apt-get update \ && apt-get install -y --no-install-recommends \ postgresql-client \ && rm -rf /var/lib/apt/lists/* WORKDIR /usr/src/app COPY Gemfile* ./ RUN bundle install COPY . . EXPOSE 3000 CMD ["rails", "server", "-b", "0.0.0.0"]
|
||||||||||||||||||||
| Docker image的build | |||||||||||||||||||||
|
docker-build -t 添加tag |
|||||||||||||||||||||
| 向Docker服务器上传image | |||||||||||||||||||||
| 容器的启动 | |||||||||||||||||||||

浙公网安备 33010602011771号