2
我有一个用于nginx的dockerfile。docker-compose图像导出和导入
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
运行后
码头工人,组成了
它创建从dockerfile图像被称为 “网络” 和下载Redis的形象也。它还创建两个图像被称为“web_web1”的组合,当我检查
泊坞窗PS
两个nginx的和Redis的服务的输出运行。我的问题是,如果我将新创建的映像提交到另一个映像,并在执行docker run命令期间将容器导出到另一个环境,它是否会启动nginx和redis服务?
用于节点,mongo和nginx的dockerfiles。现在我们可以自定义docker-compose.yml文件来运行所有的容器。 – user2439278
@ user2439278你在问题中显示的码头组成你就是这么做的。我说的是,具有不同容器名称和端口映射的* second * docker-compose.yml会再次启动* nginx和redis。 – VonC