标签:docker pytho django 重启 air admin use sudo down
docker-compose是容器编排工具,需要注意的是,docker-compose只是单机的容器编排工具
docker-compose 默认的配置文件为 : docker-compose.yaml
# 下载 ? docker文档 : `https://docs.docker.com/compose/install/` 1 sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose 2 sudo chmod +x /usr/local/bin/docker-compose ? 3 sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose ? 4 docker-compose --version
version: "3.0" services: django: image: django:v2 ports: - "8080:8080" container_name: django networks: - django depends_on: - mysql ? mysql: image: mysql:5.7 environment: MYSQL_ROOT_PASSWORD: admin123 MYSQL_DATABASE: bbs09 container_name: mysql volumes: - "/root/docker-compose/mysql/data:/var/lib/mysql" networks: - django depends_on: - redis redis: image: redis:latest container_name: redis networks: - django networks: django:
# build ? version: "3.0" services: django: build: ./django --- ? version: "3.0" services: django: build: context: ./django dockerfile: Dockerfile args: NAME: python # command : 设置容器启动命令 ? # depends_on : 指定在某容器之后启动(依赖于某容器) ? # env_file : 指定环境变量文件
`启动` : docker-compose up ? `停止并删除` : docker-compose down ? `停止` : docker-compose stop ? `删除容器` : docker-compose rm ? `重启` : docker-compose restart 容器名称 ? `进入容器` : docker-compose exec 参数 service CMD ? `容器列表` : docker-compose ps ? `查看容器进程` : docker-compose top ? `暂停运行` : docker-compose pause ? `恢复运行` : docker-compose unpause
version: ‘3.0‘ services: portainer: image: portainer/portainer-ce ports: - "8001:8000" - "9001:9000" container_name: portainer networks: - "portainer" volumes: - "/var/run/docker.sock:/var/run/docker.sock" - "/root/docker-compose/portainer_data:/data" healthcheck: test: ["CMD", "ping", "-c1", "-t1", "portainer"] interval: 30s timeout: 10s retries: 3 ? networks: portainer:
标签:docker pytho django 重启 air admin use sudo down
原文地址:https://www.cnblogs.com/chijintao/p/14932458.html