标签:bin loaded limit zoj rom style fastcgi HERE git
#1.先去查看仓库有没有镜像 root@fanwd-virtual-machine:/home# docker search nginx NAME DESCRIPTION STARS OFFICIAL AUTOMATED nginx Official build of Nginx. 14630 [OK] jwilder/nginx-proxy Automated Nginx reverse #2.下载 或者挑选版本 root@fanwd-virtual-machine:/home# docker pull nginx Using default tag: latest latest: Pulling from library/nginx 6f28985ad184: Pull complete 29f7ebf60efd: Pull complete 879a7c160ac6: Pull complete de58cd48a671: Pull complete be704f37b5f4: Pull complete 158aac73782c: Pull complete Digest: sha256:d2925188effb4ddca9f14f162d6fba9b5fab232028aa07ae5c1dab764dca8f9f Status: Downloaded newer image for nginx:latest docker.io/library/nginx:latest #3.运行测试 #-d 后台运行 # -p 宿主机端口, 容器内部端口 root@fanwd-virtual-machine:/home# docker run -d --name nginx01 -p 3344:80 nginx #--name 给容器命名 9bdc6b9197bcebaa790e623227e8250ff4baaf89bba28798dcf601015261559e root@fanwd-virtual-machine:/home# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9bdc6b9197bc nginx "/docker-entrypoint.…" 6 seconds ago Up 4 seconds 0.0.0.0:3344->80/tcp nginx01 root@fanwd-virtual-machine:/home# curl localhost:3344 <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> body { width: 35em; #进入容器 root@fanwd-virtual-machine:/home# docker exec -it nginx01 /bin/bash root@9bdc6b9197bc:/# whereis nginx nginx: /usr/sbin/nginx /usr/lib/nginx /etc/nginx /usr/share/nginx root@9bdc6b9197bc:/# cd /etc/nginx root@9bdc6b9197bc:/etc/nginx# ls conf.d fastcgi_params koi-utf koi-win mime.types modules nginx.conf scgi_params uwsgi_params win-utf root@9bdc6b9197bc:/etc/nginx#
#官方 提示tomcat下载 用完即删 root@fanwd-virtual-machine:/home# docker run -it --rm tomcat:9.0 一般用来测试 Unable to find image ‘tomcat:9.0‘ locally 9.0: Pulling from library/tomcat e22122b926a1: Pull complete f29e09ae8373: Pull complete e319e3daef68: Pull complete e499244fe254: Pull complete f3c39da3e61d: Pull complete root@fanwd-virtual-machine:/home# docker ps 没有容器正在运行 测试!!! CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES #启动运行 root@fanwd-virtual-machine:/home# docker run -d -p 3355:8080 --name tomcat01 tomcat f5ec812e266bfd91a10a5d9dcca5f7b9d34938ef208262c6f9e75f9009c947fe #测试访问没有任何问题 #进入容器 oot@fanwd-virtual-machine:/home# docker exec -it tomcat01 /bin/bash root@f5ec812e266b:/usr/local/tomcat# ls BUILDING.txt LICENSE README.md RUNNING.txt conf logs temp webapps.dist CONTRIBUTING.md NOTICE RELEASE-NOTES bin lib native-jni-lib webapps work #发现问题 1.linux命令少 #2.没有webapps #保证最小运行环境 #更改之后测试 root@f5ec812e266b:/usr/local/tomcat# cp -r webapps.dist/* webapps root@f5ec812e266b:/usr/local/tomcat# cd webapps root@f5ec812e266b:/usr/local/tomcat/webapps# ls ROOT docs examples host-manager manager #打开本地直接3355 端口访问页面
部署
#启动 root@fanwd-virtual-machine:/home# docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.6.2 Unable to find image ‘elasticsearch:7.6.2‘ locally 7.6.2: Pulling from library/elasticsearch ab5ef0e58194: Pull complete c4d1ca5c8a25: Pull complete 941a3cc8e7b8: Pull complete 43ec483d9618: Pull complete c486fd200684: Pull complete 1b960df074b2: Pull complete 1719d48d6823: Pull complete Digest: sha256:1b09dbd93085a1e7bca34830e77d2981521a7210e11f11eda997add1c12711fa Status: Downloaded newer image for elasticsearch:7.6.2 23d739bbbb9de5edbf02883d6e7e6d916238f241a3b4aac75034c4159ea6e0d4 #测试 root@fanwd-virtual-machine:/home# curl localhost:9200 { "name" : "58e7a783b6f8", "cluster_name" : "docker-cluster", "cluster_uuid" : "Ga9XmC90SuuLrzOj60_9tw", "version" : { "number" : "7.6.2", "build_flavor" : "default", "build_type" : "docker", "build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f", "build_date" : "2020-03-26T06:34:37.794943Z", "build_snapshot" : false, "lucene_version" : "8.4.0", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" } #查询运行状态 root@fanwd-virtual-machine:/home# docker stats CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS e53175153829 elasticsearch05 0.09% 1.236GiB / 3.815GiB 32.40% 3.54kB / 984B 0B / 729kB 43
docker commit #提交容器 成为一个新的副本 #命令和git类似 docker cimmit -m="#提交的描述信息" -a="作者" 容器id 目标镜像名:【标签】
#启动前一个默认的tomcat #发现这个默认的tomcat 是没有webapps应用 镜像的原因 webapps没有文件 #自己拷贝 #修改后的容器通过commit提交为新的镜像 root@fanwd-virtual-machine:/home/fanw# docker commit -a="xiaohei" -m="add webapps app" c5fe7aef1e7a tomcat02:1.0 sha256:8b239e7862abbc3e0417afe27fa749a4570f89c0b69408ec457dd7cb8574d38e root@fanwd-virtual-machine:/home/fanw# docker iamges docker: ‘iamges‘ is not a docker command. See ‘docker --help‘ root@fanwd-virtual-machine:/home/fanw# docker images REPOSITORY TAG IMAGE ID CREATED SIZE tomcat02 1.0 8b239e7862ab 13 seconds ago 672MB tomcat latest 08efef7ca980 12 days ago 667MB elasticsearch 7.6.2 f29a1ee41030 12 months ago 791MB
docker(部署nginx,tomcat、ES+Kibana)
标签:bin loaded limit zoj rom style fastcgi HERE git
原文地址:https://www.cnblogs.com/2839888494xw/p/14624730.html