gpt4 book ai didi

docker - 为 Docker 守护进程分配标签

转载 作者:行者123 更新时间:2023-12-01 03:30:10 29 4
gpt4 key购买 nike

如何为 Ubuntu 上已经运行的 Docker 守护进程分配标签?

尝试:

export DOCKER_OPTS="--label=com.example.storage=ssd"
sudo restart docker

但没有帮助。 docker info需要出示 Labels .

最佳答案

docker configuration section清楚了:

  • Log into your host as a user with sudo or root privileges.
  • If you don’t have one, create the /etc/default/docker file on your host. Depending on how you installed Docker, you may already have this file.
  • Open the file with your favorite editor.

    $ sudo vi /etc/default/docker

  • Add a DOCKER_OPTS variable with the following options. These options are appended to the docker daemon’s run command.

    DOCKER_OPTS="--label=com.example.storage=ssd"

  • Save and close the file.
  • Restart the docker daemon.

    $ sudo restart docker

关于docker - 为 Docker 守护进程分配标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38411719/

29 4 0