【Docker】五、部署常用应用

132 阅读1分钟

部署Nginx

搜索镜像 也可以在DockerHub上搜索

docker search nginx

root@lsMusKVEqm:/home# docker search nginx
NAME                              DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
nginx                             Official build of Nginx.                        16028     [OK]       
jwilder/nginx-proxy               Automated Nginx reverse proxy for docker con…   2104                 [OK]
richarvey/nginx-php-fpm           Container running Nginx + PHP-FPM capable of…   820                  [OK]
jc21/nginx-proxy-manager          Docker container for managing Nginx proxy ho…   299     

拉取镜像 也可以选择自己想要的版本

docker pull nginx

root@lsMusKVEqm:/home# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
a2abf6c4d29d: Pull complete 
f3409a9a9e73: Pull complete 
9919a6cbae9c: Pull complete 
fc1ce43285d7: Pull complete 
1f01ab499216: Pull complete 
13cfaf79ff6d: Pull complete 
Digest: sha256:366e9f1ddebdb844044c2fafd13b75271a9f620819370f8971220c2b330a9254
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest

root@lsMusKVEqm:/home# docker images
REPOSITORY   TAG       IMAGE ID       CREATED        SIZE
nginx        latest    f6987c8d6ed5   7 days ago     141MB
mysql        5.7       c20987f18b13   7 days ago     448MB
ubuntu       latest    ba6acccedd29   2 months ago   72.8MB
root@lsMusKVEqm:/home# 

启动nginx

root@lsMusKVEqm:/home# docker run -d --name nginx01 -p 7070:80 nginx
c53b74852c7dac36f6af1be99daf24f27e92c5c3a380ac47d3c20280196cff23
root@lsMusKVEqm:/home# 


# 测试
root@lsMusKVEqm:/home# curl localhost:7070
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
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@lsMusKVEqm:/home#