docker 下载nginx
[root@VM-0-14-centos home]# docker redis
docker: 'redis' is not a docker command.
See 'docker --help'
[root@VM-0-14-centos home]# docker pull redis
Using default tag: latest
latest: Pulling from library/redis
33847f680f63: Already exists
26a746039521: Pull complete
18d87da94363: Pull complete
5e118a708802: Pull complete
ecf0dbe7c357: Pull complete
46f280ba52da: Pull complete
Digest: sha256:cd0c68c5479f2db4b9e2c5fbfdb7a8acb77625322dd5b474578515422d3ddb59
Status: Downloaded newer image for redis:latest
docker.io/library/redis:latest
启动
# -d 后台运行
# --name 给容器命名
# -p 宿主机端口:容器内部端口
[root@VM-0-14-centos home]# docker run -d --name nginx01 -p 39001:80 nginx
449c6adeacf271331603497c9401b5fa536a5b165a39e7cbd54952707205da85
[root@VM-0-14-centos home]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
449c6adeacf2 nginx "/docker-entrypoint.…" 7 seconds ago Up 5 seconds 0.0.0.0:39001->80/tcp, :::39001->80/tcp nginx01
58778b7576e5 centos "/bin/bash" 56 minutes ago Up 56 minutes angry_chebyshev
[root@VM-0-14-centos home]# curl localhost:39001
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
[root@VM-0-14-centos home]# docker exec -it nginx01 /bin/bash
root@449c6adeacf2:/# whereis nginx
nginx: /usr/sbin/nginx /usr/lib/nginx /etc/nginx /usr/share/nginx
root@449c6adeacf2:/# cd /etc/nginx
root@449c6adeacf2:/etc/nginx# ls
conf.d fastcgi_params mime.typ
|