[root@localhost ~]# docker run --name httpd -dit -p 80:80 pengyudong/httpd:latest
1b7e14ac0a582266e91e5aea09db1538bf07cce695158c413d96fecc89d9d7f3
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1b7e14ac0a58 pengyudong/httpd:latest "/usr/local/apache/b…"5 seconds ago Up 4 seconds 0.0.0.0:80->80/tcp, :::80->80/tcp httpd
[root@localhost ~]# docker exec -it httpd /bin/bash[root@1b7e14ac0a58 src]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 01280.0.0.0:80 0.0.0.0:*
5. 浏览器访问
6. 上传到docker hub
[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: pengyudong
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
[root@localhost ~]# docker push pengyudong/httpd
pengyudong/httpd pengyudong/httpd:latest pengyudong/httpd:v1
[root@localhost ~]# docker push pengyudong/httpd:latest
The push refers to repository [docker.io/pengyudong/httpd]
32395be7e84b: Pushed
e00e9754c5d3: Pushed
74ddd0ec08fa: Mounted from library/centos
latest: digest: sha256:8e10aff5802691ba0a3989d2c5d84d830a9f75f8d42d26053ec4a46694e67504 size: 954[root@localhost ~]#