软硬件环境:
- 阿里云ECS
- Debian GNU/Linux 9.5 (stretch)Debian GNU/Linux 9.5 (stretch)
- Docker version 18.06.0-ce, build 0ffa825
- docker-compose version 1.21.0, build 5920eb0
- Nginx image: nginx:alpine
创建并运行Nginx容器
这里Docker的工作目录在$HOME/docker
下,以下用$DOCKER
变量指代。
在$HOME/docker
目录下的docker-compose.yml
文件中加入Nginx的配置
......
nginx:
image: "nginx:alpine"
container_name: "nginx"