Assign labels to Docker daemon

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

Tried:

  • ElasticBeanstalk: storing a bullet proof docker container
  • Building Apache Mesos cluster with Docker Compose
  • how do I clean up /dev/mapper/docker and release space?
  • I run the docker images which start tomcat8 server but it don't start
  • AWS ECS windows containers network mode issue
  • Unable to run shell script using dockerfile
  • export DOCKER_OPTS="--label=com.example.storage=ssd"
    sudo restart docker
    

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

  • How to synchronize version control system revisions with Docker image versions?
  • How to remove docker images based on name?
  • When I use Deployment in Kubernetes, what's the differences between apps/v1beta1 and extensions/v1beta1?
  • InsecurePlatformWarning when building Docker image
  • How to check if a process is running inside docker container
  • gocd docker container not sving pipelines
  • 3 Solutions collect form web for “Assign labels to Docker daemon”

    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
    

    I would guess “sudo” isn’t copying your environment. You might try “sudo -E”.

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

    did the trick for me.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.