Preparatory work:
At first, you need to register a user in https://hub.docker.com/
Demonstrates the process of uploading a mirror to the Docker hub
Pull a mirror
First you need a mirror
[Root@localhost ~]# Docker Pull benyoo/alpine:3.4.20160812
3.4.20160812:pulling from Benyoo/alpine
E110a4a17941:already exists
Digest:sha256:41250fea2bc5dfdc204d54e4d2108aae7a452876bed359ae277983aea4ae3e02
status:downloaded newer image for benyoo/alpine:3.4.20160812
Run the mirror.
[Root@localhost ~]# Docker run--name myalpine-it Benyoo/alpine:3.4.20160812/bin/bash
bash-4.3# exit
Commit
Now I commit the container
[Root@gitlab nginx]# Docker commit-m "v1" f8ac81a9f98c marksugar/nginx:8.30
sha256:e50a274c5823651858d56763d02e2cd843006a61f9ff3f97535eb7dd8d17db2f
[Root@gitlab nginx]# Docker Images
REPOSITORY TAG IMAGE ID CREATED SIZE
Marksugar/nginx 8.30 e50a274c5823 6 seconds ago 13.77 MB
Login to Docker Hub
When commit completes, log in first
[Root@localhost ~]# Docker Login
Login with your Docker ID to push and pull images from Docker Hub. If you don ' t have a Docker ID, head over to https://hub.docker.com to create one.
Username:marksugar
Password:
Login succeeded
After the commit is complete, a new one will appear in the images
[Root@localhost ~]# Docker Images
REPOSITORY TAG IMAGE ID CREATED SIZE
Marksugar/alpine latest 07a4ff4374e1 5 seconds ago 11.54 MB
Marksugar/nginx 8.30 e50a274c5823 hours ago 13.77 MB
Benyoo/alpine 3.4.20160812 0ae37ed604b2 2 weeks ago 11.54 MB
Nginx latest 0d409d33b27e 3 months ago 182.7 MB
Start uploading
Start push
[Root@localhost ~]# Docker push Marksugar/alpine
The push refers to a repository [docker.io/marksugar/alpine]
Dbe4e1a4c160:pushed
93d40cd73394:mounted from Marksugar/nginx
4fe15f8d0ae6:mounted from Marksugar/nginx
LATEST:DIGEST:SHA256:5AE1B32053247F3D251FE5EE56AA817D330CB007603272985A0AAB0B79A4C9B3 size:946
[Root@localhost ~]#
After uploading, a marksugar/alpine will appear in the Docker hub, now pull him down.
[Root@gitlab conf]# Docker Pull Marksugar/alpine
Using default Tag:latest
Latest:pulling from Marksugar/alpine
E110a4a17941:already exists
92c6475c18dd:pull Complete
Digest:sha256:5ae1b32053247f3d251fe5ee56aa817d330cb007603272985a0aab0b79a4c9b3
status:downloaded newer image for Marksugar/alpine:latest
In view Marksugar/alpine
[Root@gitlab conf]# Docker Images
REPOSITORY TAG IMAGE ID CREATED SIZE
Marksugar/nginx 1.0.1 80290b27fdc1 minutes ago 229.5 MB
Marksugar/nginx 8.31 7046101b038d minutes ago 229.6 MB
Marksugar/alpine latest 07a4ff4374e1 7 hours ago 11.54 MB
Marksugar/nginx 8.33 ba2cd7b6fa62 hours ago 13.77 MB
Centos7 7.2.1511 ad31b9ab4442 hours ago 245.3 MB
SVN 1 5d8633134e71 hours ago 288.7 MB
Benyoo/alpine 3.4.20160812 0ae37ed604b2 2 weeks ago 11.54 MB
Registry latest C6C14B3960BD 4 weeks ago 33.28 MB
Docker/compose 1.8.0 89188432ef03 4 weeks ago 59.09 MB
Hello-world latest C54A2CC56CBB 8 weeks ago 1.848 KB
KRIATION/CENTOS7 latest e8630f595772 3 months ago 198.4 MB
New1 latest e8630f595772 3 months ago 198.4 MB
10.10.239.222:5000/NEW2 latest e8630f595772 3 months ago 198.4 MB
[Root@gitlab conf]#