-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Local #2
base: main
Are you sure you want to change the base?
Conversation
So we can easily remove them using filters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great on MacOS, but breaks the tests on Linux (Port 5665 missing here):
2021-11-29T13:13:03.127Z FATAL icinga2 failed to start in time {"icinga2": true, "container-name": "icinga-testing-5ccf0926-icinga2-1-master", "container-id": "d9af68d11a5f4f0b107285ab724bd1b84ade677c57e21389e5a6dc717a2b15a2", "error": "Get \"https://192.168.32.6:/\": dial tcp 192.168.32.6:443: connect: connection refused"}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great on Linux now:
CGO_ENABLED=0 go build ./cmd/icingadb && (cd tests && go test -o ../icingadb-test -c .) && ICINGA_TESTING_ICINGADB_BINARY=$(pwd)/icingadb ICINGA_TESTING_ICINGADB_SCHEMA=$(pwd)/schema/mysql/schema.sql ./icingadb-test -icingatesting.debuglog debug.log -test.v
...
PASS
@julianbrost Which way do you prefer for port forwarding? |
I think that should say "is not unix". But just because you can directly access the container addresses doesn't mean that that's the way you should do it. So simply doing it always should make it everywhere without special-cases. The ports should only be exposed on localhost and I don't know if it's possible to achieve this with publish all. It's possible to explicitly specify the container port and host address but let Docker choose the host port: |
This is not possible with publish all and does not work for remote docker hosts like docker machine, right?
Yep, fixed. |
Why? And what's the problem? |
From my understanding, the actual address you see within the container is more of an implementation detail and it just happens to be accessible when using Docker on Linux. But I think things might be different on Windows or Mac OS (I haven't used Docker on any of these though) and the proper way to access some service running in Docker from outside a Docker container is to publish that port. |
Good point. My Docker for Desktop (VM) listens on |
Discussion
This PR suggests two ways to map ports. Port mapping occurs only when the Docker host is considered remote, which is assumed when the Docker host's address scheme is not
unix
.The first way, which is used as an example for icinga 2, is based on the publish all option and gets the assigned port from the running container. The second way chooses a free port itself and uses this information when creating the container.
Depends On
Blocks
fixes #1