Docker Cheat Sheet/Run on a specific network

Start a container attached to a chosen network.

Section: Networks

Run on a specific network

bash
bash
docker run -d --name api --network app-net myapi:latest
Explanation

Useful for service discovery between app containers.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Networks
Run a container
Create and start a new container.
OpenIn sheetbash1 tag match
Run detached
Run a container in the background.
OpenIn sheetbash1 tag match
Run interactively
Run an interactive shell inside a new container.
OpenIn sheetbash1 tag match
Publish a port
Publish a container port to the host.
OpenIn sheetbash1 tag match
Set environment variables
Pass environment variables into the container.
OpenIn sheetbash1 tag match
Load env file
Load environment variables from a file.
OpenIn sheetbash1 tag match