[root@localhost ~]# cd /mydata [root@localhost mydata]# ls elasticsearch mysql redis [root@localhost mydata]# mkdir nginx [root@localhost mydata]# ls elasticsearch mysql nginx redis [root@localhost mydata]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE redis latest 7614ae9453d1 2 years ago 113MB mysql 5.7 c20987f18b13 2 years ago 448MB kibana 7.4.2 230d3ded1abc 4 years ago 1.1GB elasticsearch 7.4.2 b1179d41a7b4 4 years ago 855MB [root@localhost mydata]# docker run -p 80:80 --name nginx -d nginx:1.10 Unable to find image 'nginx:1.10' locally 1.10: Pulling from library/nginx 6d827a3ef358: Pull complete 1e3e18a64ea9: Pull complete 556c62bb43ac: Pull complete Digest: sha256:6202beb06ea61f44179e02ca965e8e13b961d12640101fca213efbfd145d7575 Status: Downloaded newer image for nginx:1.10 96a4d65fc40977872c8af56e3ec7154f066dffc208c2a4c9e262ed25c2f05ac6 [root@localhost mydata]# docker container cp nginx:/etc/nginx . Successfully copied 26.6kB to /mydata/. [root@localhost mydata]# ls elasticsearch mysql nginx redis [root@localhost mydata]# cd nginx/ [root@localhost nginx]# ls conf.d fastcgi_params koi-utf koi-win mime.types modules nginx.conf scgi_params uwsgi_params win-utf [root@localhost nginx]# docker stop nginx nginx [root@localhost nginx]# docker rm -f nginx nginx [root@localhost nginx]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE redis latest 7614ae9453d1 2 years ago 113MB mysql 5.7 c20987f18b13 2 years ago 448MB kibana 7.4.2 230d3ded1abc 4 years ago 1.1GB elasticsearch 7.4.2 b1179d41a7b4 4 years ago 855MB nginx 1.10 0346349a1a64 7 years ago 182MB [root@localhost nginx]# docker rm nginx Error response from daemon: No such container: nginx [root@localhost nginx]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1b6793c54215 elasticsearch:7.4.2 "/usr/local/bin/dock…" 12 minutes ago Up 12 minutes 0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 0.0.0.0:9300->9300/tcp, :::9300->9300/tcp elasticsearch-p 5a879124a74b kibana:7.4.2 "/usr/local/bin/dumb…" 7 days ago Up 18 minutes 0.0.0.0:5601->5601/tcp, :::5601->5601/tcp kibana 25a5439186fa d445c0adc9a5 "docker-entrypoint.s…" 2 months ago Up 18 minutes 4369/tcp, 5671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp, 0.0.0.0:5673->5672/tcp, :::5673->5672/tcp rabbit db61879bdaf3 redis "docker-entrypoint.s…" 4 months ago Up 18 minutes 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp redis 8b875b01624e mysql:5.7 "docker-entrypoint.s…" 4 months ago Up 18 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql [root@localhost nginx]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE redis latest 7614ae9453d1 2 years ago 113MB mysql 5.7 c20987f18b13 2 years ago 448MB kibana 7.4.2 230d3ded1abc 4 years ago 1.1GB elasticsearch 7.4.2 b1179d41a7b4 4 years ago 855MB nginx 1.10 0346349a1a64 7 years ago 182MB [root@localhost nginx]# cd ../ [root@localhost mydata]# mv nginx conf [root@localhost mydata]# ls conf elasticsearch mysql redis [root@localhost mydata]# mkdir nginx [root@localhost mydata]# mv conf nginx/ [root@localhost mydata]# ls elasticsearch mysql nginx redis [root@localhost mydata]# cd nginx/ [root@localhost nginx]# ls conf [root@localhost nginx]# docker run -p 80:80 --name nginx \ > -v /mydata/nginx/html:/usr/share/nginx/html \ > -v /mydata/nginx/logs:/var/log/nginx \ > -v /mydata/nginx/conf:/etc/nginx \ > -d nginx:1.10 4f19fab031f08f46c1444ff38452d41aed589422692085c2c8f3ce2110d52149 [root@localhost nginx]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4f19fab031f0 nginx:1.10 "nginx -g 'daemon of…" 6 seconds ago Up 4 seconds 0.0.0.0:80->80/tcp, :::80->80/tcp, 443/tcp nginx 1b6793c54215 elasticsearch:7.4.2 "/usr/local/bin/dock…" 15 minutes ago Up 15 minutes 0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 0.0.0.0:9300->9300/tcp, :::9300->9300/tcp elasticsearch-p 5a879124a74b kibana:7.4.2 "/usr/local/bin/dumb…" 7 days ago Up 20 minutes 0.0.0.0:5601->5601/tcp, :::5601->5601/tcp kibana 25a5439186fa d445c0adc9a5 "docker-entrypoint.s…" 2 months ago Up 20 minutes 4369/tcp, 5671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp, 0.0.0.0:5673->5672/tcp, :::5673->5672/tcp rabbit db61879bdaf3 redis "docker-entrypoint.s…" 4 months ago Up 20 minutes 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp redis 8b875b01624e mysql:5.7 "docker-entrypoint.s…" 4 months ago Up 20 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp
[root@localhost ~]# cd /mydata
[root@localhost mydata]# ls
elasticsearch mysql redis
[root@localhost mydata]# mkdir nginx
[root@localhost mydata]# ls
elasticsearch mysql nginx redis
[root@localhost mydata]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
redis latest 7614ae9453d1 2 years ago 113MB
mysql 5.7 c20987f18b13 2 years ago 448MB
kibana 7.4.2 230d3ded1abc 4 years ago 1.1GB
elasticsearch 7.4.2 b1179d41a7b4 4 years ago 855MB
[root@localhost mydata]# docker run -p 80:80 --name nginx -d nginx:1.10
Unable to find image 'nginx:1.10' locally
1.10: Pulling from library/nginx
6d827a3ef358: Pull complete
1e3e18a64ea9: Pull complete
556c62bb43ac: Pull complete
Digest: sha256:6202beb06ea61f44179e02ca965e8e13b961d12640101fca213efbfd145d7575
Status: Downloaded newer image for nginx:1.10
96a4d65fc40977872c8af56e3ec7154f066dffc208c2a4c9e262ed25c2f05ac6
[root@localhost mydata]# docker container cp nginx:/etc/nginx .
Successfully copied 26.6kB to /mydata/.
[root@localhost mydata]# ls
elasticsearch mysql nginx redis
[root@localhost mydata]# cd nginx/
[root@localhost nginx]# ls
conf.d fastcgi_params koi-utf koi-win mime.types modules nginx.conf scgi_params uwsgi_params win-utf
[root@localhost nginx]# docker stop nginx
nginx
[root@localhost nginx]# docker rm -f nginx
nginx
[root@localhost nginx]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
redis latest 7614ae9453d1 2 years ago 113MB
mysql 5.7 c20987f18b13 2 years ago 448MB
kibana 7.4.2 230d3ded1abc 4 years ago 1.1GB
elasticsearch 7.4.2 b1179d41a7b4 4 years ago 855MB
nginx 1.10 0346349a1a64 7 years ago 182MB
[root@localhost nginx]# docker rm nginx
Error response from daemon: No such container: nginx
[root@localhost nginx]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1b6793c54215 elasticsearch:7.4.2 "/usr/local/bin/dock…" 12 minutes ago Up 12 minutes 0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 0.0.0.0:9300->9300/tcp, :::9300->9300/tcp elasticsearch-p
5a879124a74b kibana:7.4.2 "/usr/local/bin/dumb…" 7 days ago Up 18 minutes 0.0.0.0:5601->5601/tcp, :::5601->5601/tcp kibana
25a5439186fa d445c0adc9a5 "docker-entrypoint.s…" 2 months ago Up 18 minutes 4369/tcp, 5671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp, 0.0.0.0:5673->5672/tcp, :::5673->5672/tcp rabbit
db61879bdaf3 redis "docker-entrypoint.s…" 4 months ago Up 18 minutes 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp redis
8b875b01624e mysql:5.7 "docker-entrypoint.s…" 4 months ago Up 18 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql
[root@localhost nginx]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
redis latest 7614ae9453d1 2 years ago 113MB
mysql 5.7 c20987f18b13 2 years ago 448MB
kibana 7.4.2 230d3ded1abc 4 years ago 1.1GB
elasticsearch 7.4.2 b1179d41a7b4 4 years ago 855MB
nginx 1.10 0346349a1a64 7 years ago 182MB
[root@localhost nginx]# cd ../
[root@localhost mydata]# mv nginx conf
[root@localhost mydata]# ls
conf elasticsearch mysql redis
[root@localhost mydata]# mkdir nginx
[root@localhost mydata]# mv conf nginx/
[root@localhost mydata]# ls
elasticsearch mysql nginx redis
[root@localhost mydata]# cd nginx/
[root@localhost nginx]# ls
conf
[root@localhost nginx]# docker run -p 80:80 --name nginx \
> -v /mydata/nginx/html:/usr/share/nginx/html \
> -v /mydata/nginx/logs:/var/log/nginx \
> -v /mydata/nginx/conf:/etc/nginx \
> -d nginx:1.10
4f19fab031f08f46c1444ff38452d41aed589422692085c2c8f3ce2110d52149
[root@localhost nginx]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4f19fab031f0 nginx:1.10 "nginx -g 'daemon of…" 6 seconds ago Up 4 seconds 0.0.0.0:80->80/tcp, :::80->80/tcp, 443/tcp nginx
1b6793c54215 elasticsearch:7.4.2 "/usr/local/bin/dock…" 15 minutes ago Up 15 minutes 0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 0.0.0.0:9300->9300/tcp, :::9300->9300/tcp elasticsearch-p
5a879124a74b kibana:7.4.2 "/usr/local/bin/dumb…" 7 days ago Up 20 minutes 0.0.0.0:5601->5601/tcp, :::5601->5601/tcp kibana
25a5439186fa d445c0adc9a5 "docker-entrypoint.s…" 2 months ago Up 20 minutes 4369/tcp, 5671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp, 0.0.0.0:5673->5672/tcp, :::5673->5672/tcp rabbit
db61879bdaf3 redis "docker-entrypoint.s…" 4 months ago Up 20 minutes 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp redis
8b875b01624e mysql:5.7 "docker-entrypoint.s…" 4 months ago Up 20 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp
Nginx准备一个映射了端口和配置文件的Nginx服务器------Nginx
最新推荐文章于 2024-08-14 18:26:28 发布