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.
Several forums are saying to add the following to /etc/docker/daemon.json
:
{
"bip": "192.168.1.1/24"
}
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.
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!
No need extra entity:
--bip "192.168.1.1/24"
at the end of line ExecStart=/usr/bin/dockerd
. systemctl daemon-reload
systemctl start docker
Tested on Ubuntu 16.04 with Docker 17.03-ce.
Edit on 2018-09-13:
Since we might still need user-defined bridge networks, there is still a potential issue.
By default bridge is assigned one subnet from the ranges 172.[17-31].0.0/16 or 192.168.[0-240].20/20 which does not overlap with any existing interface. Unlike the default bridge network, user-defined networks supports manual IP address and subnet assignment. If an assignment is not given, then Docker’s default IPAM driver assigns the next subnet available in the private space.
Thougt they say it would not overlap with any existing interfaces on host, you still suffered such an issue. So if you need user-defined bridge networks, you’d better assign specific subnet for them. As I know, there is no parameters for customizing IPAM driver default pool.