Build镜像命令
使用Dockerfile文件构建镜像
Usage: docker build [OPTIONS] PATH | URL | - Options: -t, --tag list # 镜像名称 -f, --file string # 指定Dockerfile文件位置
示例: docker docker docker docker docker docker docker
build . # 默认找当前目录以Dockerfile为命名的文件 build -t shykes/myapp . build -t shykes/myapp -f /path/Dockerfile /path build -t shykes/myapp - < Dockerfile
build -t shykes/myapp - < context.tar.gz build -t shykes/myapp http://www.example.com/Dockerfile build -f shykes/myapp http://www.example.com/contex.tar.gz
FROM centos:6 MAINTAINER lizhenliang
RUN yum install -y httpd php php-gd php-mysql mysql mysql-server ENV MYSQL_ROOT_PASSWORD 123456 RUN echo "<?php phpinfo()?>" > /var/www/html/index.php ADD start.sh /start.sh
RUN chmod +x /start.sh
ADD https://cn.wordpress.org/wordpress-4.7.4-zh\_CN.tar.gz /var/www/html COPY wp-config.php /var/www/html/wordpress
VOLUME ["/var/lib/mysql"] CMD /start.sh EXPOSE 80 3306
# cat start.sh service httpd start service mysqld start mysqladmin -uroot password $MYSQL_ROOT_PASSWORD tail -f
FROM centos:6 MAINTAINER lizhenliang
ENV ROOT_PASSWORD 123456
RUN yum install -y openssh-server RUN echo $ROOT_PASSWORD |passwd --stdin root
RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
CMD ["/usr/sbin/sshd", "-D"] EXPOSE 22