Home › Docker Tutorial › Run containers: docker run
Run containers: docker run
Start a container from an image.
-d runs in the background (detached), --name gives it a name, and -p HOST:CONTAINER publishes a port: here your port 8080 reaches port 80 inside. --rm deletes the container when it stops. docker ps lists running containers (add -a to include stopped ones).
Example code
docker run -d --name web -p 8080:80 nginx:1.27
docker ps