Question

How can I expose one Docker container on the App Platform to Another?

Hey there,

I know that when I run some Docker containers locally using Docker Compose, if I configure it correctly, a container can access another container via its hostname.

For example, if I have two containers, a Celery Worker and a RabbitMQ container (the RabbitMQ container exposes port 5672). When the RabbitMQ container starts, I can connect to the RabbitMQ queue from the Celery container using the RabbitMQ container name, something like:

rabbitmq:5672

I tried looking for this in the DigitalOcean docs but I couldn’t find anything. Do I just use the container name the same way I would if I was running them locally?

Also, with Docker Compose, I can tell Celery to depend on RabbitMQ, i.e. it won’t start until the RabbitMQ container is up and healthy. Is that also possible with AppPlatform?

Just to add, everything I’m running all apps in Docker containers on AppPlatform.

Thanks in advance!

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.

Jon Friesen
DigitalOcean Employee
DigitalOcean Employee badge
October 4, 2022
Accepted Answer

👋 Mark,

Components within the same app can be accessed by their component name. For example, if I had a service with the name “api” that exposed an http server, it can be accessed at http://api.

App Platform does not have the functionality to depend on other component start up times. That sounds like it could be a good feature for us to implemement though, feel free to submit it as an Idea.

Hope this helps!

Try DigitalOcean for free

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

Sign up

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