Sending build context to Docker daemon 12.29kB Step 1/7 : FROM centos:7 ---> 8652b9f0cb4c Step 2/7 : LABEL maintainer="DeepMountains" ---> Using cache ---> 83f8205ce7e0 Step 3/7 : RUN mkdir -p /etc/docker_test ---> Using cache ---> eabf7253e75c Step 4/7 : RUN yum install python3 -y ---> Running in 881d1ed87f7e Loaded plugins: fastestmirror, ovl Determining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package python3.x86_64 0:3.6.8-18.el7 will be installed --> Processing Dependency: python3-libs(x86-64) = 3.6.8-18.el7 for package: python3-3.6.8-18.el7.x86_64 --> Processing Dependency: python3-setuptools for package: python3-3.6.8-18.el7.x86_64 --> Processing Dependency: python3-pip for package: python3-3.6.8-18.el7.x86_64 --> Processing Dependency: libpython3.6m.so.1.0()(64bit) for package: python3-3.6.8-18.el7.x86_64 --> Running transaction check ---> Package python3-libs.x86_64 0:3.6.8-18.el7 will be installed --> Processing Dependency: libtirpc.so.1()(64bit) for package: python3-libs-3.6.8-18.el7.x86_64 ---> Package python3-pip.noarch 0:9.0.3-8.el7 will be installed ---> Package python3-setuptools.noarch 0:39.2.0-10.el7 will be installed --> Running transaction check ---> Package libtirpc.x86_64 0:0.2.4-0.16.el7 will be installed --> Finished Dependency Resolution
Dependencies Resolved
================================================================================ Package Arch Version Repository Size ================================================================================ Installing: python3 x86_64 3.6.8-18.el7 updates 70 k Installing for dependencies: libtirpc x86_64 0.2.4-0.16.el7 base 89 k python3-libs x86_64 3.6.8-18.el7 updates 6.9 M python3-pip noarch 9.0.3-8.el7 base 1.6 M python3-setuptools noarch 39.2.0-10.el7 base 629 k
# 第一步登陆docker,在hub.docker.com上可以注册用户。推出登陆使用logout命令 # 登陆了之后所有的pull操作都会在个人仓库中查找 $ docker login Login with your Docker ID to push and pull images from Docker Hub. Username: deepmountains Password: Login Succeeded
# 第二步给docker镜像打上tag $ docker tag mypython3:latest deepmountains/mypython3:lmb1.0 $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE deepmountains/mypython3 lmb1.0 3b704de398aa 4 hours ago 364MB
# 创建私有仓库容器 $ docker run -id --name lmbregistry -p 5000:5000 -v /root/docker/registry/:/var/lib/registry registry 15af55c3134ef6ffab7794ce83a7558247e8e059893ff27bcdf8e6108f5bfe50 $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 15af55c3134e registry "/entrypoint.sh /etc…" About a minute ago Up About a minute 0.0.0.0:5000->5000/tcp lmbregistry
# push镜像至私有仓库 $ docker tag mypython3 192.168.222.200:5000/mypython3:lmb1.0 $ docker push 192.168.222.200:5000/mypython3:lmb1.0 The push refers to repository [192.168.222.200:5000/mypython3] 713a84d3be51: Pushed a33aed951d88: Pushed 9dfcd2f3e89a: Pushed 174f56854903: Pushed lmb1.0: digest: sha256:0159cd84f32f7a56f014b2935f8b9a30249af499af5624d8c8e594f45cd15f38 size: 1159 $ cd docker/registry/docker/registry/v2/repositories/ $ ls mypython3