Arun Gupta
Arun Gupta

Reputation: 4035

Assign labels to Docker daemon

How do I assign labels to an already running Docker daemon on Ubuntu?

Tried:

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

but didn't help. docker info need to show Labels.

Upvotes: 5

Views: 1259

Answers (3)

Arun Gupta
Arun Gupta

Reputation: 4035

sudo sed -i `'/DOCKER_OPTS/c\DOCKER_OPTS="--label=com.example.storage=ssd"' /etc/default/docker`

did the trick for me.

Upvotes: 1

VonC
VonC

Reputation: 1326782

The docker configuration section is clear:

  • 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

Upvotes: 1

David M. Karr
David M. Karr

Reputation: 15235

I would guess "sudo" isn't copying your environment. You might try "sudo -E".

Upvotes: 0

Related Questions