Skip to content

sagi-z/update-docker-dns

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

update-docker-dns

Selectively expose docker containers by name.

[Install 1/3] Copy the script to where it belongs

sudo cp update-docker-dns.sh /usr/loca/bin

[Install 2/3] Add dnsmasq support

  • If you have a Network Manager (most linux desktops), and it is using dnsmasq:
sudo bash -c "cat > /etc/NetworkManager/dnsmasq.d/docker-dns"
addn-hosts=/etc/docker-container-hosts
^D
sudo systemctl restart network-manager.service
  • If you don't have a Network Manager, or it is not using dnsmasq:
sudo apt install -y dnsmasq
sudo bash -c "cat > /etc/dnsmasq.d/docker-dns"
addn-hosts=/etc/docker-container-hosts
^D
sudo systemctl restart dnsmasq.service

[Install 3/3] Register it as a system service

sudo bash -c "cat > /etc/systemd/system/docker-dnsmasq.service"
[Unit]
Description=Update dnsmasq with selected docker containers
After=docker.service dnsmasq.service network-manager.service

[Service]
ExecStart=/usr/local/bin/update-docker-dns.sh
Restart=on-failure

[Install]
WantedBy=multi-user.target
^D
sudo systemctl enable docker-dnsmasq.service
sudo systemctl start docker-dnsmasq.service

Usage

See Install and test example. See Usage example.

About

Selectively expose docker containers by name

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages