How I can expose extra ports in my digital ocean docker container?

Good Day! I deployed docker container used service “APP - > Docker Hub” (not a droplet). For image I used with code-server.

When I was configuring container, I could expose only one port - port 8443. I wanna use that container for remoute web development. And I need some open ports like 3000, 5000 and etc.

When I deployed that image on my own local docker server I used docker-compose file, where added neccesary extra ports

ports: - 8443:8443 - 3000:3000 - 8000:8000 - 5000:5000

I search for answer on a forum, and found only that.

But there is a little bit something else.

1)How I can expose extra ports in my digital ocean docker container? 2)Or I have to deploy droplet, install there docker and deploy my yaml docker-compose file 3)Or I have to deploy droplet and install there code-server directly. 4)And why in the marketplace isn’t pre-built Droplet image with a code-server? Or may be I could not find that one.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
April 3, 2021
Accepted Answer

Hi there,

There was a similar question regarding the DigitalOcean App Platform here:

Kamal answered that it’s currently not possible to expose multiple external ports on a Service. If it works with your setup you could use the same websocket server and put the existing servers under separate path prefixes

Alternatively, you could use a Droplet with Docker installed:

Once you have a Droplet with a Docker installed you can follow the steps from the answer that you’ve shared in order to start a container with multiple exposed ports.

Also, you can follow the steps on how to run code server on your Droplet here:

As of the time being there is no image with code server on the Marketplace.

Hope that this helps. Regards, Bobby

I had this same problem today. Basically, I need to run the container with -p 9898:9898/udp (notice the UDP).

Please, DO, consider adding the possibility of mapping custom ports in our containers. The App Platform is very convenient for automating deployment; going back to a Droplet feels disheartening now.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel