Set container port dynamically (use a variable)


Pickl3s
Go to solution Solved by Squid,

Recommended Posts

Is it possible to set the conatiner port dynamically?

 

I have a container running on ports 8095 and 40123 by default.

I can change this via 2 variables (but this also affects the server, so the container ports would have to be changed as well)

 

What I mean as command

 

Default:

docker run -p 8095:8095 -p 40123:40123 ...

 

With modified ports:

docker run --env WEB_PORT=1234 --env=API_PORT=4321 -p 1234:1234 -p 4321:4321 ...

 

How can I set this dynamically in the config?

 

 

Bildschirmfoto vom 2022-11-05 16-01-38.png

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.