Skip to content

Instantly share code, notes, and snippets.

@Richard-Mathie
Last active April 15, 2016 09:46
Show Gist options
  • Save Richard-Mathie/a62b4a6f2095f9631139f3505f20050a to your computer and use it in GitHub Desktop.
Save Richard-Mathie/a62b4a6f2095f9631139f3505f20050a to your computer and use it in GitHub Desktop.
Changing Labels on aws docker engine launched by docker machine

First ssh into the node you want to add lable to

docker-machine ssh aws-node

Depending on wheather the machine is using upstart or systemd you will need to modify a config file:

systemd:

sudo vim /etc/systemd/system/docker.service

edit the line starting ExecStart to add label

ExecStart=/usr/bin/docker daemon -H .... --label provider=amazonec2 **--label your=newlabel** --cluster-store=consul://ip:8500 --cluster-advertise=eth0:0 
MountFlags=slave

reload demon units

sudo systemctl daemon-reload

upstart:

echo "DOCKER_OPTS=\$DOCKER_OPTS --label your=newlabel" | sudo tee -a /etc/default/docker

Restart the docker engine

sudo service docker restart

Restart the containers

export DOCKER_HOST=unix:///var/run/docker.sock
sudo docker start $(sudo docker ps -aq)

check the containers are up

sudo docker ps

check the docker entgine info

sudo docker info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment