After starting docker-ce (18.06.1-ce, build e68fc7a) on Ubuntu Server 16.04, the following is created:
$ ifconfig
docker0 Link encap:Ethernet HWaddr 02:42:fe:36:81:72
inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Unfortunately, my PC is on this network. Meaning that as soon as the docker starts, I lose ssh connectivity to the server.
Attempt 1
Several forums are saying to add the following to /etc/docker/daemon.json
:
{
"bip": "192.168.1.1/24"
}
Attempt 2, using this SO accepted answer
One possible solution that is working is running:
sudo ip addr add dev docker0 192.168.1.1/24
sudo ip addr del dev docker0 172.17.0.1/16
Source: forums.docker.com
Although this is a possible solution, I have to do it after the docker service starts. Something I can't do because I lose connectivity meanwhile.
Attempt 3, following @Light.G answer
After adding the -bip
to ExecStart
line, trying to start docker gives (journalctl -xe):
-- Unit docker.socket has begun starting up.
Sep 11 11:13:19 PTLISLABHLC01 systemd[1]: Listening on Docker Socket for the API.
-- Subject: Unit docker.socket has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.socket has finished starting up.
--
-- The start-up result is done.
Sep 11 11:13:19 PTLISLABHLC01 systemd[1]: docker.service: Start request repeated too quickly.
Sep 11 11:13:19 PTLISLABHLC01 systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
Sep 11 11:13:19 PTLISLABHLC01 systemd[1]: docker.socket: Unit entered failed state.
Sep 11 11:13:19 PTLISLABHLC01 polkitd(authority=local)[1062]: Unregistered Authentication Agent for unix-process:15666:32644036 (system bus name :1.56, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Only error here is that you should use --bip
and not -bip
. Check the accepted answer!