一.nginx镜像的使用
1.下载nginx.tar,并加载nginx镜像
[root@server1 images]# docker load -i nginx.tar
2.查看加载的nginx镜像
[root@server1 images]# docker images nginx
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest e548f1a579cf 13 months ago 109MB
3.使用docker镜像nginx以后台模式启动一个容器,并将容器命名为vm1
[root@server1 images]# docker run -d --name vm1 -p 80:80 nginx
ab01748bcf6eef898aad056e36d69c46a568d8198e260eafc2071086a74b9f0e
4.访问页面172.25.28.1
自己编写index.html文件,并将其拷贝到容器vm1的默认发布目录,然后访问172.25.28.1
[root@server1 mnt]# pwd
/mnt
[root@server1 mnt]# vim index.html
<h1>www.westos.org</h1>
[root@server1 mnt]# docker cp index.html vm1:/usr/share/nginx/html
二.ubuntu镜像的使用
[root@server1 mnt]# docker rm -f vm1
vm1
1.下载ubuntu.tar,并加载ubuntu镜像
[root@server1 images]# docker load -i ubuntu.tar
2.查看加载的ubuntu镜像
[root@foundation83 images]# docker images ubuntu
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest 07c86167cdc4 3 years ago 188MB
3.使用docker镜像ubuntu以后台模式启动一个容器,并将容器命名为vm1,并在bash交互界面进行测试
三.rhel7镜像的使用
[root@server1 mnt]# docker rm -f vm1
vm1
1.下载rhel7.tar,并加载rhel7镜像
[root@server1 images]# docker load -i rhel7.tar
2.查看加载的rhel7镜像
[root@server1 images]# docker images rhel7
REPOSITORY TAG IMAGE ID CREATED SIZE
rhel7 latest 0a3eb3fde7fd 4 years ago 140MB
3.使用docker镜像rhel7以后台模式启动一个容器,并将容器命名为vm1,并在bash交互界面进行测试