title: Docker, host-OS restart and busy ports
body: <p>I started learning docker and I use it on Linux ubuntuserver 4.15.0-34-generic. I created container by this command:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>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.</p>
  
  <p>But after rebooting the host system the container is in Exited state </p>
  
  <pre><code>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
  </code></pre>
  
  <p>and I can not start the container. I see this:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>In order to start I have to type these commands:</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>Then I kill the processes (in this example 1328 and 1316) and then I can start container by typing:</p>
  
  <pre><code>docker container start FBSServer
  </code></pre>
  
  <p>So the question number 1:
  Why after rebooting host system ports are "busy"? </p>
  
  <p>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.</p>