Sync with Docker

hostctl allows you synchronize your hosts file with docker containers a simple command.

All sync actions will replace previous content of the given profile.

Example

Once you have some containers up and running, you can create names for all of them to their container IP.

Command:

hostctl sync docker awesome

Output:

+---------+--------+------------+------------------------+
| PROFILE | STATUS |     IP     |         DOMAIN         |
+---------+--------+------------+------------------------+
| awesome | on     | 172.17.0.2 | mystifying_wescoff.loc |
| awesome | on     | 172.17.0.2 | my-awesome-web.loc     |
+---------+--------+------------+------------------------+
If you start your docker containers without --name it will have a random container name.

Available Options

  • --domain,-d some.domain domain name used for all containers.

  • --network networkID|networkName filter only containers of an specific docker network.


Last updated by Sven Luijten on August 20, 2023 at 10:27 +0200