docker 命令整理
2022-09-30 10:05 默默不语 阅读(25) 评论(0) 编辑 收藏 举报-
查看版本
docker -v
-
列出正在运行的容器
docker ps
-
列出所有容器
docker ps -a
-
启动/停止容器
docker start/stop containerID
-
进入容器
docker exec -it docker_web_1 /bin/sh
-
列出所有镜像
docker images -a
-
容器管理GUI
-
location
-
install
docker run -d -p 8000:8000 -p 9900:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
-
-
设置代理
FQ:Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
sudo mkdir -p /etc/systemd/system/docker.service.d sudo vi /etc/systemd/system/docker.service.d/http-proxy.conf [Service] Environment="HTTP_PROXY=http://webproxy.bu.edu:8900" Environment="HTTPS_PROXY="http://webproxy.bu.edu:8900" sudo systemctl daemon-reload sudo systemctl restart docker
-
LDAP
docker run -p 389:389 -p 636:636 --name ldap --detach osixia/openldap
-
PHPAdmin
- install
docker run -dit -p 8990:80 --link ldap --name ldapadmin --env PHPLDAPADMIN_HTTPS=false --env PHPLDAPADMIN_LDAP_HOSTS=LDAP --restart always --detach osixia/phpldapadmin
- account
cn=admin,dc=example,dc=org admin
- install
-
docker 查看 container 的 ip
docker inspect container_id | grep IPAddress
-
docker nginx reverse proxy
- How to setup a Docker Nginx reverse proxy server example
-
Start with the official Nginx image
docker run -d --name nginx-base -p 80:80 nginx:latest
-
Copy the Nginx config file from Docker
docker cp nginx-base:/etc/nginx/conf.d/default.conf ./default.conf
-
Nginx and Docker reverse proxy configuration
# Complete Nginx Docker reverse proxy config file server { listen 80; listen [::]:80; server_name localhost; location / { root /usr/share/nginx/html; index index.html index.htm; } location /sample { proxy_pass http://localhost:8080/sample; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } } # End of Docker Nginx reverse proxy example file
-
Copy the Nginx config file back to Docker
docker cp ./default.conf nginx-base:/etc/nginx/conf.d/
-
validate and reload the Docker Nginx reverse proxy configuration
docker exec nginx-base nginx -t docker exec nginx-base nginx -s reload
-
- How to setup a Docker Nginx reverse proxy server example