首页 > 技术文章 > Docker-compose学习随笔

ucas123 2020-11-08 15:04 原文

version: '3.4'    #版本

services:
nginx: #容器的名称
image: nginx #容器的镜像名称,默认获取最新版镜像
ports:
- "80:80" #容器的端口号 宿主机端口:容器端口
links:
- app #其他容器的ip,映射
volumes:
- "./nginx.conf.d/:/etc/nginx/conf.d/" 当前主机文件目录 与 容器内的相应目录的一一 映射
app: #容器的名称
image: luban/app

ifconfig 查看主机的ip

cat /etc/hosts  查看主机的ip

推荐阅读