publish new post
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2020-09-08 22:17:06 +02:00
parent c7e233161c
commit f2c5a63a18
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61
3 changed files with 23 additions and 0 deletions

View File

@ -19,3 +19,4 @@ Proxmox
VE VE
Ansible Ansible
symlink symlink
localhost

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 KiB

View File

@ -0,0 +1,22 @@
---
title: "Docker port publishing for localhost bindings"
date: 2020-09-08T22:15:00+02:00
authors:
- robert-kaussow
tags:
- Sysadmin
- Container
- Today I learned
resources:
- name: feature
src: "images/feature.jpg"
params:
anchor: Center
credits: >
[Andy Li](https://unsplash.com/@andasta) on
[Unsplash](https://unsplash.com/s/photos/container)
---
While preparing a custom Docker image for a tool I wanted to use I encountered a problem that kept me busy for some time. The container could be built and started without any problems but the application in the container was simply not accessible via the published port.
Even after minutes of debugging and checking (and re-checking over and over again) that the right port was exposed and the application in the container is listening on that port I was not able to get it to work... But I had a suspicion now. For some reason I had decided to bind the application in the container to localhost. Though it may sound obvious now, I didn't expect that with a binding like `127.0.0.0:9000` you can't publish port `9000` to the host; or maybe I'm just too stupid to fully understand Docker networking. After I changed the binding to `0.0.0.0:9000` everything worked as expected. Anyway, lesson learned.