[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: dockerimages123 //dockerHub的账号
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 dockerimages123/httpd:latest
The push refers to repository [docker.io/dockerimages123/httpd]
f94dd84f3e96: Pushed
f0fa09713fb2: Pushed
3e99ea88e70c: Pushed
810c6bdb9955: Pushed
4ed7682ecfc4: Pushed
a8cf66ede8e5: Pushed
74ddd0ec08fa: Layer already exists
latest: digest: sha256:d513bbe573d28ff3838deb5e1d8cf8f5a94f3a6bcca4fb609494dc32b5dd81e8 size: 1793
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2eaf3c89658c dockerimages123/httpd:v2.0 "/sbin/init" 34 minutes ago Up 34 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp, 443/tcp web03
7. 启动apache服务
[root@2eaf3c89658c ~]# systemctl enable --now httpd
[root@2eaf3c89658c ~]# systemctl status httpd.service
● httpd.service - httpd server daemon
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2021-12-09 06:22:06 UTC; 3h 7min ago
Main PID: 89 (httpd)
Tasks: 6 (limit: 11201)
Memory: 11.2M
CGroup: /docker/2eaf3c89658c5dd138c6d5cc3cb6d707e0162a3310d0a03aba93f84faf50444c/system.slice/httpd.service
├─89 /usr/local/apache/bin/httpd -k start
├─91 /usr/local/apache/bin/httpd -k start
├─92 /usr/local/apache/bin/httpd -k start
├─93 /usr/local/apache/bin/httpd -k start
├─94 /usr/local/apache/bin/httpd -k start
└─95 /usr/local/apache/bin/httpd -k start
Dec 09 06:22:05 2eaf3c89658c systemd[1]: Starting httpd server daemon...
Dec 09 06:22:06 2eaf3c89658c apachectl[50]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. >
Dec 09 06:22:06 2eaf3c89658c systemd[1]: Started httpd server daemon.