【发布时间】:2016-01-29 07:21:38
【问题描述】:
我有一个用于 nginx 的 dockerfile。
FROM ubuntu
# File Author / Maintainer
MAINTAINER Maintaner Name
# Install Nginx
# Add application repository URL to the default sources
RUN echo "deb http://archive.ubuntu.com/ubuntu/ raring main universe" >> /etc/apt/sources.list
# Update the repository
RUN apt-get update
# Install necessary tools
RUN apt-get install -y nano wget dialog net-tools
# Download and Install Nginx
RUN apt-get install -y nginx
# Remove the default Nginx configuration file
RUN rm -v /etc/nginx/nginx.conf
# Copy a configuration file from the current directory
ADD nginx.conf /etc/nginx/
# Append "daemon off;" to the beginning of the configuration
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
# Expose ports
EXPOSE 80
# Set the default command to execute
# when creating a new container
CMD service nginx start
我有一个 docker-compose.yml 文件。
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/code
links:
- redis
redis:
image: redis
运行后
码头工人组成
它从名为“web”的 dockerfile 创建图像并下载 redis 图像。它还创建了名为“web_web1”的图像的组合,当我检查了
的输出时码头工人ps
nginx 和 redis 服务都在运行。我的问题是,如果我将新创建的镜像提交到另一个镜像并导出容器并导入另一个环境,在执行 docker run 命令期间,它会同时启动 nginx 和 redis 服务吗?
【问题讨论】:
标签: docker dockerfile docker-compose