devops-exercises/topics/containers/run_forest_run.md
abregman 99c4e02ecf Rename exercises dir
Name it instead "topics" so it won't be
strange if some topics included "exercises" directory.
2022-08-02 01:53:56 +03:00

898 B

Run, Forest, Run!

Objective

Learn what restart policies do and how to use them

Requirements

Make sure Docker is installed on your system and the service is started

# Fedora/RHEL/CentOS
rpm -qa | grep docker
systemctl status docker

Instructions

  1. Run a container with the following properties:
  • image: alpine
  • name: forest
  • restart policy: always
  • command to execute: sleep 15
  1. Run docker container ls - Is the container running? What about after 15 seconds, is it still running? why?
  2. How then can we stop the container from running?
  3. Remove the container you've created
  4. Run the same container again but this time with sleep 600 and verify it runs
  5. Restart the Docker service. Is the container still running? why?
  6. Update the policy to unless-stopped
  7. Stop the container
  8. Restart the Docker service. Is the container running? why?