下载centos系统镜像
[root@docker ~]
使用镜像启动容器并进入容器
[root@docker ~]
安装epel源和nginx
[root@369372c88fd6 /]
[root@369372c88fd6 /]
配置nginx为前台启动模式
在nginx的配置文件中加入如下参数
vi /etc/nginx/nginx.conf
daemon off;
查看容器
[root@docker ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
369372c88fd6 centos "/bin/bash" About a minute ago Exited (0) 3 seconds ago centos.nginx
596d668963f3 nginx "/docker-entrypoint.…" 2 hours ago Up 2 hours 80/tcp b1
86bd7474d739 nginx "/docker-entrypoint.…" 2 hours ago Exited (0) 2 hours ago eager_margulis
7d382d20bb59 ubuntu:15.10 "/bin/bash" 7 hours ago Exited (127) 7 hours ago recursing_visvesvaraya
5a11a555bbe8 ubuntu:15.10 "/bin/echo 'Hello wo…" 7 hours ago Exited (0) 7 hours ago epic_kilby
制作镜像
[root@docker ~]
sha256:7d17908e5897a0b87768fcad4e902018d030739b1b98c40834c81a80b95994e4
查看镜像
[root@docker ~]
REPOSITORY TAG IMAGE ID CREATED SIZE
centos-nginx latest 7d17908e5897 9 seconds ago 345MB
ubuntu latest 1318b700e415 39 hours ago 72.8MB
nginx latest 08b152afcfae 6 days ago 133MB
httpd latest 73b8cfec1155 6 days ago 138MB
<none> <none> 65c9239c9300 3 weeks ago 1.24MB
busybox latest 69593048aa3a 7 weeks ago 1.24MB
hello-world latest d1165f221234 4 months ago 13.3kB
centos latest 300e315adb2f 7 months ago 209MB
ubuntu 15.10 9b9cb95443b5 5 years ago 137MB
使用新镜像启动容器
[root@docker ~]
021ddfcec4c75f9adac1b79d95e207ffb8b6d6d802066915c11dcdb02230b90d
[root@docker ~]
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 0.0.0.0:8888 0.0.0.0:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 128 [::]:8888 [::]:*
[root@docker ~]
[root@70bfaf3d4b7a /]
[root@70bfaf3d4b7a /]
[root@70bfaf3d4b7a /]
Busybox page test.
[root@docker ~]
sha256:2ed3d7464d74900c9960cecdce1ecad72903a500ed7f0171675118b89a76acee
[root@docker ~]
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> 2ed3d7464d74 5 seconds ago 209MB
centos-nginx latest 7d17908e5897 11 minutes ago 345MB
ubuntu latest 1318b700e415 40 hours ago 72.8MB
nginx latest 08b152afcfae 6 days ago 133MB
httpd latest 73b8cfec1155 6 days ago 138MB
<none> <none> 65c9239c9300 3 weeks ago 1.24MB
busybox latest 69593048aa3a 7 weeks ago 1.24MB
hello-world latest d1165f221234 4 months ago 13.3kB
centos latest 300e315adb2f 7 months ago 209MB
ubuntu 15.10 9b9cb95443b5 5 years ago 137MB
[root@docker ~]
[root@docker ~]
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> 2ed3d7464d74 10 minutes ago 209MB
18463751776/centos-nginx 0.1 7d17908e5897 21 minutes ago 345MB
centos-nginx/centos-nginx 0.1 7d17908e5897 21 minutes ago 345MB
centos-nginx latest 7d17908e5897 21 minutes ago 345MB
ubuntu latest 1318b700e415 40 hours ago 72.8MB
nginx latest 08b152afcfae 6 days ago 133MB
httpd latest 73b8cfec1155 6 days ago 138MB
<none> <none> 65c9239c9300 3 weeks ago 1.24MB
busybox latest 69593048aa3a 7 weeks ago 1.24MB
hello-world latest d1165f221234 4 months ago 13.3kB
centos latest 300e315adb2f 7 months ago 209MB
ubuntu 15.10 9b9cb95443b5 5 years ago 137MB
登录上传
[root@docker ~]
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: 18463751776
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/
Login Succeeded
[root@docker ~]
The push refers to repository [docker.io/centos-nginx/centos-nginx]
44d45c8164a7: Preparing
2653d992f4ef: Preparing
denied: requested access to the resource is denied
|