FROM image-A
#Automatically run the following
ADD . /app/src
RUN /usr/local/bin/python-build --dir /app/src使用 ONBUILD 指令的镜像,推荐在标签中注明,例如
ruby:1.9-onbuild。创建镜像
编写完成 Dockerfile 之后,可以通过 docker build 命令来创建镜像。
docker build -t 镜像名字 .
// 注意 . 不能忘。下面两个Dockerhub上的Dockerfile的例子。
# Nginx
#
# VERSION 0.0.1
FROM ubuntu
MAINTAINER Victor Vieux <victor@docker.com>
RUN apt-get update && apt-get install -y inotify-tools nginx apache2 openssh-server
# 在ubuntu的父镜像基础上安装inotify-tools,nginx,apache2,openssh-server,从而创建一个新的Nginx镜像。
# Firefox over VNC
#
#VERSION 0.3
FROM ubuntu
# Install vnc,xvfb in order to create a 'fake' display and firefox
RUN apt-get update && apt-get install -y x11vnc firefox
RUN mkdir /.vnc
# Setup a pssword
RUN x11vnc -storepasswd 1234 ~/.vnc/passwd
#Autostart firefox
RUN bash -c 'echo "firefox" >> /.bashrc'
EXPOSE 5900
CMD ["x11vnc", "-forever", "-usepw", "-create"]# 基于ubuntu父镜像,安装firefox和vnc软件,启动后,用户可以通过5900端口通过vnc方式使用firefox。总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对软件开发网的支持。如果你想了解更多相关内容请查看下面相关链接
您可能感兴趣的文章:docker搭建php+nginx+swoole+mysql+redis环境的方法Docker 容器日志分析使用docker快速部署Elasticsearch集群的方法使用Docker部署MySQL 5.7&8.0主从集群的方法步骤使用dockercompose搭建springboot-mysql-nginx应用使用Docker部署Spring Boot的方法示例使用Docker部署Nginx+Flask+Mongo的应用详细记一次Docker部署服务的爬坑历程docker中的环境变量使用与常见问题解决方案docker打包node项目的过程讲解










