DOCKER · Containers · 5 min

Run a named container

Start the prepared image and keep its process running.

Not completed

Your task

Run opsrung-run:practice in the background with the container name opsrung-run and networking disabled.

What you’re aiming for

  • The container opsrung-run is running.
  • It uses opsrung-run:practice.
  • Its network mode is none.

1. Prepare your practice folder

Use a running Docker engine in Linux container mode. The setup commands below use a Bash-compatible shell: Git Bash on Windows, or Bash on Linux/macOS.

Create a new, empty folder for this exercise. If that name already exists, choose another new name. Continue only after you’re inside the new folder.

NEW PRACTICE FOLDER
mkdir opsrung-docker-run-container && cd opsrung-docker-run-container

Run these setup commands in that folder:

SETUP — RUN ONCE
cat > Dockerfile <<'DOCKERFILE'
FROM alpine:3.22
USER 65534:65534
CMD ["sleep","3600"]
DOCKERFILE
docker build -t opsrung-run:practice .

Docker may download the official Alpine image and, for the web task, its HTTP package. If an example container name already exists, use a different name consistently. If port 8088 is occupied, choose another free local port.

2. Try the task

Work toward the goal above. Start by inspecting the files or resources, then use a hint if you need one.

Hint 1

Build the starter image using the setup commands above before attempting this task.

Hint 2

Use --name for the requested name, -d for background mode, and --network none.

Hint 3

Check docker ps after starting it.

3. Review your result

Use these commands to look at your result and compare it with the goals. The website does not run or verify them.

REVIEW IN YOUR TERMINAL
docker ps --filter name=opsrung-run
docker inspect --format '{{.HostConfig.NetworkMode}}' opsrung-run

What you should see

  • docker ps lists opsrung-run with image opsrung-run:practice and a status beginning with Up.
  • The network-mode inspection command prints none.

If your result differs: Use the image you built during setup. If the name is already in use, choose another name consistently; do not remove an unrelated container. The practice process stops after one hour.

Compare with one possible solution
ONE POSSIBLE SOLUTION
docker run -d --name opsrung-run --network none --read-only --cap-drop ALL --security-opt no-new-privileges opsrung-run:practice
docker ps

Other approaches are fine if you reach the same goal. Opening this solution does not mark the exercise complete.

Clean up this exercise

Only remove the example resources you created. Volume cleanup deletes that exercise’s saved sample data. Keep anything you need.

OPTIONAL CLEANUP
docker stop opsrung-run
docker rm opsrung-run
docker image rm opsrung-run:practice

Finished this exercise?

You decide when you’re done. Your choice is saved in this browser, and you can change it later.