Assigning my docker an ip on a custom docker network


Recommended Posts

this is my first attempt at creating a docker container and running it on UnRaid.

 

I create my container using docker build.  I then try to run it with:

 

docker run --name heatmaster --ip='192.168.20.246' -d heatmaster

 

It runs, but I don't get assigned that ip address. I can get a console into it as well, but the IP address is a 127... address, not the one I assigned.

 

How do I got about assigning an ip address to the container?  I got my command line by looking at an UnRaid container when it started up.

 

thanks

david

Link to comment

Ok I figured out that I need to at least do:

docker run --net br0.10 --name heatmaster --ip='192.168.10.246' -p="5000" -d hello-world

 

This does create it so that I can see in the Docker page the correct IP address:port.  It looks just like the others.

 

However, when I try to go to the port I get a permission denied message.

 

If I get a console, I can access at 127.0.0.1:5000 just fine.

 

Here is my container:

FROM ubuntu

RUN apt-get update
RUN apt-get -y install python3
RUN apt-get -y install python3-pip
RUN apt-get -y install curl
RUN pip install flask
RUN pip install playwright

ADD app.py /
ADD heatmaster.py /
WORKDIR /

USER nobody

EXPOSE 5000

CMD ["python3","app.py"]

 

Do I have to something on the CMD line to say to run on port 5000?

 

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.