This repository has been archived by the owner on Mar 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
17 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |