[英]docker-compose image export and import
我有一个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”的图像和我检查输出时的组合
码头工人
nginx和redis服务都在运行。 我的问题是,如果我将新创建的图像提交到另一个图像并导出容器并导入到另一个环境,在执行docker run命令期间,它是否会启动nginx和redis服务?
我的问题是,如果我将新创建的图像提交到另一个图像并导出容器并导入到另一个环境,在执行docker run命令期间,它是否会启动nginx和redis服务?
您所需要的只是更改docker-compose.yml
声明的容器名称和端口映射,您可以根据需要启动这些图像的多个实例(无需导出/导入)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.