Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.

Commit

Permalink
docs(docker): 更新docker-compose使用缺点
Browse files Browse the repository at this point in the history
  • Loading branch information
zjZSTU committed Jan 2, 2020
1 parent f281e65 commit 7f7ef56
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions docs/docker/compose/使用docker-compose还是docker run.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@

# 使用docker-compose还是docker run

学习了`Docker``Docker Compose`,通过`Dockerfile`文件进行镜像的构建,通过`docker-compose.yml`文件进行容器的运行
学习了`Docker``Docker Compose`,通过`Dockerfile`文件进行镜像的构建,通过`docker-compose.yml`文件进行容器的编排

在实际操作过程中,`docker-compose`操作的优点很明显

优点:

1. 通过`docker-compose.yml`文件配置容器启动选项,结构清晰
2. 能够实现多容器的管理

不过这种方式存在一个缺陷,那就是**`docker-compose.yml`中仅能使用环境变量,无法操作`shell`命令**
不过`docker-compose`还在不断更新中,存在不少问题:

1.`docker-compose.yml`中仅能使用环境变量,无法操作`shell`命令

比如获取当前用户信息

```
$ id -u
$ id -g
```
```

2. 在语法版本`3.7`中无法设置`NVIDIA`

参考:

[Support for NVIDIA GPUs under Docker Compose #6691](https://github.com/docker/compose/issues/6691)

[docker-compose support #1073](https://github.com/NVIDIA/nvidia-docker/issues/1073)

[NVIDIA Container Toolkit](https://github.com/NVIDIA/nvidia-docker)

>Please note that this native GPU support has not landed in docker-compose yet. Refer to this issue for discussion.

0 comments on commit 7f7ef56

Please sign in to comment.