docker_file编写-07
一、docker_file文件编写
参考官网:https://hub.docker.com/_/centos/
docker_file是用来全自动的构建文件。
1.2、download centos6.6的dockerfile
#查看是否有wget [root@docker-node1 ~]# rpm -qa wget wget-1.14-15.el7_4.1.x86_64 #download centos6.6 docker_file [root@docker-node1 ~]# wget https://github.com/CentOS/sig-cloud-instance-images/blob/8911843d9a6cc71aadd81e491f94618aded94f30/docker/Dockerfile --2018-06-21 07:50:45-- https://github.com/CentOS/sig-cloud-instance-images/blob/8911843d9a6cc71aadd81e491f94618aded94f30/docker/Dockerfile Resolving github.com (github.com)... 13.229.188.59, 13.250.177.223, 52.74.223.119 Connecting to github.com (github.com)|13.229.188.59|:443... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] Saving to: ‘Dockerfile’ [ <=> ] 56,659 152KB/s in 0.4s 2018-06-21 07:50:47 (152 KB/s) - ‘Dockerfile’ saved [56659] [root@docker-node1 ~]# ll total 64 -rw-------. 1 root root 1262 Jun 16 18:21 anaconda-ks.cfg -rw-r--r--. 1 root root 56659 Jun 21 07:50 Dockerfile -rw-r--r--. 1 root root 91 Jun 16 23:18 docker_init.sh #创建并移到docker文件夹中 mkdir docker mv Dockerfile docker cd docker #清空文件 echo > Dockerfile
1.3、编写Dockerfile
vim Dockerfile
#build
#查看所有images
#运行nginx
#
#进入容器
#curl
1.4、官方示例
1.5、mysql镜像
[root@docker-node1 docker]# docker pull mysql Using default tag: latest Trying to pull repository docker.io/library/mysql ... latest: Pulling from docker.io/library/mysql f2aa67a397c4: Already exists 1accf44cb7e0: Pulling fs layer 2d830ea9fa68: Pulling fs layer 740584693b89: Pulling fs layer 4d620357ec48: Waiting ac3b7158d73d: Waiting a48d784ee503: Waiting f122eadb2640: Waiting
1.6、registry镜像
[root@docker-node1 ~]# docker pull registry Using default tag: latest Trying to pull repository docker.io/library/registry ... latest: Pulling from docker.io/library/registry 81033e7c1d6a: Pulling fs layer b235084c2315: Pulling fs layer c692f3a6894b: Pulling fs layer ba2177f3a70e: Waiting a8d793620947: Waiting