GithubHelp home page GithubHelp logo

Docker Port revisited about flatnotes HOT 4 CLOSED

aguileraGit avatar aguileraGit commented on June 6, 2024
Docker Port revisited

from flatnotes.

Comments (4)

dullage avatar dullage commented on June 6, 2024

Hey @aguileraGit 👋.

Inside the container the server always starts on port 8080. But Docker lets you map that internal port to another port outside the container.

When using docker run the flag would look something like -p 1234:8080. I've not used Portainer myself but I would imagine you can do something similar?

from flatnotes.

aguileraGit avatar aguileraGit commented on June 6, 2024

Hey @dullage. Yes, Portainer provides a way to house multiple Docker Compose files (among others). Instead of having a folder with a bunch of Docker Compose files, it has an interface to organize, store, and edit them. Following the Docker Compose example on the README, -p 1234:8080 should expose port 1234 the same way docker run works. But it doesn't. When I look at the logs, I see it starting on 8080.

ERROR:    [Errno 98] error while attempting to bind on address ('0.0.0.0', 8080): address already in use

This might be a limitation of my setup. I have multiple containers running and using the HOST IP. It just makes it easier for me to load a container using hostIP:port, where each port points to a different container. Except in this case. I'm trying to host multiple containers that have the same internal port (8080).

I think if I changed the networking type, then containers could all use port 8080 and then can be 'mapped' to an external port. I'll do a little more reading.

from flatnotes.

dullage avatar dullage commented on June 6, 2024

Based on this from the Portainer docs it looks possible. Let me know how you get on.

from flatnotes.

aguileraGit avatar aguileraGit commented on June 6, 2024

I'm going to close this. The issue is specific to running containers with network_mode = HOST AND services inside containers use the same port.

As a test, I've cloned this repo, changed the port to 8181, built the image, and deployed the container without any errors.

Ideally, an argument port in entrypoint.sh could be added. This is similar to ${PGID} and others. This also means moving the HEALTHCHECK from the dockerfile to docker compose. Not sure how that works with just docker.

I'll put a little more effort into this. I rather have docker pull your latest version instead of having to merging updates into my repo and fighting with git since Dockerfile and entrypoint.sh differ. Thoughts?

from flatnotes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.