1 [ec2-user@ip-10-0-0-104 ~]$ docker load -i httpd.tar
2 3c816b4ead84: Loading layer 58.47MB/58.47MB
3 f8a0a368bee8: Loading layer 2.56kB/2.56kB
4 e1049375b47d: Loading layer 34.6MB/34.6MB
5 9464fb202df9: Loading layer 43.59MB/43.59MB
6 eae00250502c: Loading layer 3.584kB/3.584kB
7 Loaded image: httpd:latest
8 [ec2-user@ip-10-0-0-104 ~]$ docker images
9 REPOSITORY TAG IMAGE ID CREATED SIZE
10 httpd latest e40405f80704 3 years ago 132MB
11 [ec2-user@ip-10-0-0-104 ~]$ docker run -itd --name httpd -p 8001:80 --restart=always httpd
12 a0fd9691399b15a62dee7d4bcdb89012ea67248cdbd208080a06d4c2b0447acd
13 后台运行
14 [ec2-user@ip-10-0-0-104 ~]$ docker stop a0fd9691399b 停止
15 a0fd9691399b
16 [ec2-user@ip-10-0-0-104 ~]$ docker rm a0fd9691399b 删除容器 rmi删除镜像
17 a0fd9691399b
18 [ec2-user@ip-10-0-0-104 ~]$ docker run -t -i -p 8001:80 httpd
19 AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
20 AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
21 [Wed Apr 27 01:26:22.765298 2022] [mpm_event:notice] [pid 1:tid 140521299924160] AH00489: Apache/2.4.38 (Unix) configured -- resuming normal operations
22 [Wed Apr 27 01:26:22.765644 2022] [core:notice] [pid 1:tid 140521299924160] AH00094: Command line: 'httpd -D FOREGROUND'
23 39.165.100.145 - - [27/Apr/2022:01:26:43 +0000] "GET / HTTP/1.1" 200 45
24 39.165.100.145 - - [27/Apr/2022:01:26:44 +0000] "GET /favicon.ico HTTP/1.1" 404 209
25 39.165.100.145 - - [27/Apr/2022:01:26:46 +0000] "GET / HTTP/1.1" 304 -
[ec2-user@ip-10-0-0-104 ~]$ docker run --privileged=true -itd --name demo -p 80:8001 --restart=always demo:v1.0
b052d7eb0b103c884a03e5938b1fbc1ae6ebb82d2734f95dc893e96f83048c9d
[ec2-user@ip-10-0-0-104 ~]$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b052d7eb0b10 demo:v1.0 "/usr/sbin/init" 2 minutes ago Up 2 minutes 0.0.0.0:80->8001/tcp, :::80->8001/tcp demo