I started learning docker (Docker version 18.06.1-ce, build e68fc7a) and I use it on Linux ubuntuserver 4.15.0-34-generic. I created container by this command:
sudo docker run -d --privileged --name FBSServer --hostname BACKUPSERVER --restart=always -p 4530:4530 -p 4531:4531 -v /home/adminek/synology:/fbs ferro/backupsystem FBS_Server
As you see container is listening on ports 4530 and 4531. When I ran this command for the first time, everything was OK. The container is running and I can communicate with an app using ports 4530/4531.
But after rebooting the host system the container is in Exited state
root@ubuntuserver:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6e77a4729847 ferro/backupsystem "/start.sh FBS_Server" 7 hours ago Exited (128) About a minute ago FBSServer
and I can not start the container. I see this:
root@ubuntuserver:~# docker container start FBSServer
Error response from daemon: driver failed programming external connectivity on endpoint FBSServer (c2afb35a61a18c65e8c306bbf36d4e2c9cdf428aafa386e12281d2d9e714b238): Error starting userland proxy: listen tcp 0.0.0.0:4531: bind: address already in use
Error: failed to start containers: FBSServer
In order to start I have to type these commands:
root@ubuntuserver:~# lsof -i :4530 | grep LISTEN
docker-pr 1328 root 4u IPv6 35086 0t0 TCP *:4530 (LISTEN)
root@ubuntuserver:~# lsof -i :4531 | grep LISTEN
docker-pr 1316 root 4u IPv6 35059 0t0 TCP *:4531 (LISTEN)
Then I kill the processes (in this example 1328 and 1316) and then I can start container by typing:
docker container start FBSServer
So the question number 1:
Why after rebooting host system ports are “busy”?
and number 2:
Why sometimes after rebooting host system I see that the changes in container were not saved? In other words - after reboot and made commands from above container is up, but it is in state without last changes I made a while before reboot the host.