Jekyll, Docker, Windows, and 0.0.0.0 I recently attempted to set up Jekyll using Docker on Windows after running successfully on macOS for a few months. What I expected to be a relatively trivial exercise ended up involving issues with operating system networking, absolute URLs, and behaviour in Jekyll. Docker is a full development platform for creating containerized apps, and Docker for Mac is the best way to get started with Docker on a Mac. See Install Docker for Mac for information on system requirements and stable & edge channels.
![Docker For Mac 0.0.0.0 Docker For Mac 0.0.0.0](/uploads/1/2/5/3/125350418/728400883.png)
Could you upload diagnostics from a reproduction on 1.12.1? The diagnostics in 1.12.1 are much better than in 1.12.0, in particular they include a process list from inside the VM which would show ports being held open from there. (The port opening is requested by the docker engine by running a proxy process, which communicates with a server on the Mac which actually opens the port. When the process inside the VM quits, the ports are closed on the Mac) It would also really help if someone could help me reproduce this.
Has anyone got a simple script or compose file they could share? Every time I try to repro this it always seems to work as expected:( For example if I run an nginx in one terminal: $ docker run -it -p 80:80 -p 443:443 nginx and then in another terminal $ curl lots of html. I can see the ports bound via netstat: $ netstat -an less Active Internet connections (including servers) Proto Recv-Q Send-Q Local Address Foreign Address (state) tcp4 0 0.80. LISTEN tcp4 0 0.443. LISTEN. I can then Control+C the docker run and the ports go away. If I run docker run again it all comes back as expected:( For a more complicated example, if I clone the example-voting-app: $ git clone git://github.com/docker/example-voting-app Cloning into 'example-voting-app'.
Remote: Counting objects: 238, done. Remote: Total 238 (delta 0), reused 0 (delta 0), pack-reused 238 Receiving objects: 100% (238/238), 182.09 KiB 0 bytes/s, done. Resolving deltas: 100% (71/71), done. I can repeatedly bring it up and down with $ docker-compose up -d # manually verify that ports 5000 and 5001 are bound $ docker-compose down # manually verify that ports 5000 and 5001 are free with no error:(. Just wanted to add, I ran into this as well, but on different ports. ➜ lsof grep 16380 com.docke 14092 cory 20u IPv4 0xc6baa1d6e0a73c6d 0t0 TCP.:16380 (LISTEN) com.docke 14092 cory 21u IPv6 0xc6baa1d6d43e7c75 0t0 TCP localhost:16380 (LISTEN) (LISTEN) This was with no containers running, and even after removing all containers, restarting docker, and then finally reinstalling docker for mac.
Restoring factory settings and setting everything up again now. Fortunately, that part is all automated. But it's a very odd problem. Similar problem here. Container using port 3000/3001 cannot be started: 'Bind for 0.0.0.0:3001 failed: port is already allocated'. When I remove port 3001, I get the same message for port 3000. Happened this morning, no problems the days before, no system updates in between.
Stopped/removed container, restarted docker daemon ('sudo service docker restart'), but no result. Netstat shows this: tcp6 0 0:::3000:::.
LISTEN 7039/docker-proxy tcp6 0 0:::3001:::. LISTEN 7031/docker-proxy I start container with '-p 0.0.0.0:3000:3000 -p 0.0.0.0:3001:3001' options. I am on a slow internet connection, so removing docker folder and recreating all images is not really an option at the moment. The only way I can get around this is using a different port: '-p 0.0.0.0:4000:3000 -p 0.0.0.0:4001:3001'. There must be some way to release these ports?? Docker version: Client: Version: 1.12.1 API version: 1.24 Go version: go1.6.3 Git commit: 23cf638 Built: Thu Aug 18 05: OS/Arch: linux/amd64 Server: Version: 1.12.1 API version: 1.24 Go version: go1.6.3 Git commit: 23cf638 Built: Thu Aug 18 05: OS/Arch: linux/amd64.
What's your new diagnostic ID? I can only see the logs related to your initial issue, where you hit an osxfs bug which was fixed after Beta21: Detected symptom of problem 'invariant-violated' in 269F8ACE-C09C-4FB4-856C-82/20140. An invariant within the code of one of the components was not held. Docker needs to be restarted. The same issue on OSX 10.12 (build: 16A323) with Docker version: 1.12.1 (2d5b4d9).
After rebooting MAC. I've got one of my services declared in docker-compose.yml (webpack) like that: ports: - '3000:3000' docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES docker-compose up ERROR: for webpack Cannot start service webpack: driver failed programming external connectivity on endpoint webpack1 (456a452bfa9bcbc6a296265c23cb57bd11c203430aee4b01b6eb9e9312ead2b0): Bind for 0.0.0.0:3000 failed: port is already allocated ERROR: Encountered errors while bringing up the project. Logs: /tmp/79ABB4D6-AC97-498B-9C28-BFA79AE6C99E/20108.tar.gz OK docker-cli OK virtualization kern.hvsupport OK menubar OK moby-syslog OK dns OK disk OK system OK app OK osxfs OK virtualization VT-X OK db OK slirp OK logs OK env OK vmnetd OK moby-console OK moby OK driver.amd64-linux Suggestions of roelvanhintum no result. I checked it again, here is what i did to solve it: remove the network listed in docker network ls stop docker to release the port (after this the port should be unused on your mac) start docker (the port should not be in use before starting any containers) Restoring to factory defaults did the trick!
But this solution is in the forehead, as the situation is repeated often enough, including other ports which are specified in the docker-compose.yml file. A small update: this could be related to the issue - under some circumstances the docker engine keeps a port allocated even though there is no associated container. Hopefully the upcoming 1.12.3 will have some fixes in this area. On the linked ticket some people reported success with a workaround: (NB I've had to tweak this to remove mention of systemctl) First get a shell inside the VM: docker run -rm -net=host -pid=host -privileged -it justincormack/debian nsenter -m -t 1 sh Next delete the kv store which contains the network information inside the VM: rm /var/lib/docker/network/files/local-kv.db Next logout of the shell in the VM and restart the app.
With luck this avoids the need to perform a factory reset. Let me know if this helps (or not). I'll let you know when there's an update with some relevant patches in.
ERROR: Cannot start service webpack: driver failed programming external connectivity on endpoint webpack1 (11daa633feb41ea0cad4086d80bc0b1524ebcb8ffe2c): Bind for 0.0.0.0:3000 failed: port is already allocated ERROR: Encountered errors while bringing up the project. First get a shell inside the VM: docker run -rm -net=host -pid=host -privileged -it justincormack/debian nsenter -m -t 1 sh Next delete the kv store which contains the network information inside the VM: rm /var/lib/docker/network/files/local-kv.db Hooray! There is no need to throw off to the factory settings. If you suddenly need a diagnosis. BA3EF875-A019-4578-9D7C-C0212AA758F2 Docker for Mac: version: 1.12.1 (2d5b4d9) OS X: version 10.12 (build: 16A323) logs: /tmp/BA3EF875-A019-4578-9D7C-C0212AA758F2/20142.tar.gz OK docker-cli OK virtualization kern.hvsupport OK menubar OK moby-syslog OK dns OK disk OK system OK app OK osxfs OK virtualization VT-X OK db OK slirp OK logs OK env OK vmnetd OK moby-console OK moby OK driver.amd64-linux. After putting together pieces from various sources, this is the whole process that worked for me:. Get a shell to the VM by connecting via screen: screen /Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty.
![Docker For Mac 0.0.0.0 Docker For Mac 0.0.0.0](/uploads/1/2/5/3/125350418/408415602.png)
Hit Enter to see the shell prompt. Run rm /var/lib/docker/network/files/local-kv.db to clear network information, including the allocated ports. Exit the VM shell by killing the screen session with the key sequence: Ctrl-A Ctrl-K.
Answer y when prompted with Really kill this window y/n. Restart Docker. Same problem with Version 1.12.3-beta29.2 (13499) Diagnostic ID: B9ACA12E-2617-41AD-9A22-97 Docker for Mac: version: 1.12.3-beta29.2 (902414d) OS X: version 10.12.1 (build: 16B2555) logs: /tmp/B9ACA12E-2617-41AD-9A22-97/20126.tar.gz OK vmnetd OK dns OK driver.amd64-linux OK virtualization VT-X OK app OK moby OK system OK moby-syslog OK db OK env OK virtualization kern.hvsupport OK slirp OK osxfs OK moby-console OK logs OK docker-cli OK menubar OK disk. I'm running Docker for Mac Version 1.13.0 (15072) on Sierra 10.12.2 and I'm having this problem as well. I've reset docker and have the issue running the following container. Docker run -d -name db -p 8091-8094:8091-8094 -p 0 couchbase With the output docker: Error response from daemon: driver failed programming external connectivity on endpoint db (8a5c3df508167f520b681e9f796cf5303120eca1e4857f253e9e198138da675d): Error starting userland proxy: Bind for 0.0.0.0:8091 failed: port is already allocated. I wonder why this issue is closed when this issue persists in the current 'stable' release.
After starting containers with host ports, and then stopping and removing (!) them, the ports seems to be still allocated and I need to restart the docker daemon in order to start new container with the same host port. EDIT: This is also not fixed in the edge version. To reproduce this, just run container with host port set, then kill that container and delete it. Then run another container with this command: 'cat /proc/net/tcp && ( -e /proc/net/tcp6 && cat /proc/net/tcp6 true)') and you will see that host port still allocated in Docker VM.