如何为Ubuntu上已经运行的Docker守护程序分配标签?
尝试:
export DOCKER_OPTS="--label=com.example.storage=ssd"
sudo restart docker
但没有帮助. docker info需要显示标签.
最佳答案
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