- Traning
- 去Github搜索Training教程
- Docker镜像是分层的(在docker build的过程中能够体现出来)
- Registry库 构建自动化平台,持续集成
- 更新DockerFile之后
docker build
自动生成新的Docker Image - 这个就需要借助Git了,有git之后才能说自动化平台
- 这就是有持续集成,Jenkins的作用了
- 更新DockerFile之后
生成Docker Image
docker build -t Image_name/Image_version DockerFile_Path
- 通过DockerFile生成Docker Image
- -t 给Image起一个名字
- 命名规则 : registry_url/namespace/Image_password/Image_name:Image_version(也就是Tag,不写的话,默认生成的就是latest)
shell
Loaded plugins: fastestmirror
Cleaning repos: base epel extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
---> 813309c5c189
Removing intermediate container 458a7d8a9119
Step 7 : RUN pip install supervisor
---> Running in 9d04f00a0723
/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting supervisor
/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading supervisor-3.1.3.tar.gz (391kB)
Collecting meld3>=0.6.5 (from supervisor)
Downloading meld3-1.0.2-py2.py3-none-any.whl
Installing collected packages: meld3, supervisor
Running setup.py install for supervisor
Successfully installed meld3-1.0.2 supervisor-3.1.3
---> 15d5fc74da64
Removing intermediate container 9d04f00a0723
Step 8 : ADD supervisord.conf /etc/supervisord.conf
---> cc30d52cc27a
Removing intermediate container 0a68ce165085
Step 9 : RUN mkdir -p /etc/supervisor.conf.d && mkdir -p /var/log/supervisor
---> Running in bf31cf925d62
---> 1f8441516965
Removing intermediate container bf31cf925d62
Step 10 : EXPOSE 22
---> Running in def88536757d
---> 0d82c89bc153
Removing intermediate container def88536757d
Step 11 : ENTRYPOINT /usr/bin/supervisord -n -c /etc/supervisord.conf
---> Running in 0ed8448107f7
---> 6cc4c6a7ee5d
Removing intermediate container 0ed8448107f7
Successfully built 6cc4c6a7ee5d
根据Docker Image 运行 Container
sudo docker run -d -p 2222:22 —–name centos_base centos_liuyanshi:latest
docker run -it(以交互模式运行)/-d(后台模式运行,返回一个Container ID)
- -P / -p端口映射
docker run -d -P 22
宿主机的随机分配的端口和Container的22端口进行映射EXPOSE 22
docker run -d -p 2222:22
宿主机的2222端口和Container的22端口进行映射
- 基础镜像
2015年10月17日23:39:55 -Step1