To start a stopped container, use docker start, followed by the container ID or the container’s name. Let’s start the Ubuntu-based container with the ID of 1c08a7a0d0e4:

docker start 1c08a7a0d0e4
The container will start, and you can use docker ps to see its status:

OutputCONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
1c08a7a0d0e4        ubuntu              "/bin/bash"         3 minutes ago       Up 5 seconds                            quizzical_mcnulty
To stop a running container, use docker stop, followed by the container ID or name. This time, we’ll use the name that Docker assigned the container, which is quizzical_mcnulty:

docker stop quizzical_mcnulty
Once you’ve decided you no longer need a container anymore, remove it with the docker rm command, again using either the container ID or the name. Use the docker ps -a command to find the container ID or name for the container associated with the hello-world image and remove it.

docker rm youthful_curie
Your environment is now up and running, but we still need to execute a couple commands to finish setting up the application. You can use the docker-compose exec command to execute commands in the service containers, such as an ls -l to show detailed information about files in the application directory:

docker-compose exec app ls -l
If you want to pause your Docker Compose environment while keeping the state of all its services, run:

docker-compose pause
To shut down your Docker Compose environment and remove all of its containers, networks, and volumes, run:

docker-compose down
After using Docker for a while, you’ll have many active (running) and inactive containers on your computer. To view the active ones, use:

docker ps
To view all containers — active and inactive, run docker ps with the -a switch:

docker ps -a
You’ll see output similar to this:

1c08a7a0d0e4        ubuntu              "/bin/bash"         2 minutes ago       Exited (0) 8 seconds ago                       quizzical_mcnulty
a707221a5f6c        hello-world         "/hello"            6 minutes ago       Exited (0) 6 minutes ago                       youthful_curie

Recommend

How To Install and Use Docker on Ubuntu 20.04 Step 6 — Managing Docker Containers

How To Install and Use Docker on Ubuntu 20.04 Step 5 — Running a Docker Container

How To Install and Use Docker on Ubuntu 20.04 Step 4 — Working with Docker Images

How To Install and Use Docker on Ubuntu 20.04 Step 3 — Using the Docker Command

How To Install and Use Docker on Ubuntu 20.04 Step 2 — Executing the Docker Command Without Sudo (Optional)

How To Install and Use Docker on Ubuntu 20.04 Step 1 — Installing Docker

Использование Visual Studio Code для удаленной разработки с помощью плагина Remote-SSH Шаг 3 — Выполнение кода на удаленном сервере

Использование Visual Studio Code для удаленной разработки с помощью плагина Remote-SSH Шаг 2 — Настройка плагина Remote-SSH и подключение к серверу

Built-in Python 3 Functions for Working with Numbers Prerequisites Still looking for an answer?

Built-in Python 3 Functions for Working with Numbers Calculating a Sum

Built-in Python 3 Functions for Working with Numbers Rounding Numbers

Built-in Python 3 Functions for Working with Numbers Power

Built-in Python 3 Functions for Working with Numbers Absolute Value Finding the Quotient and Remainder in One Function

Built-in Python 3 Functions for Working with Numbers Absolute Value

Cómo indexar, dividir y manipular cadenas en JavaScript Búsqueda y sustitución de valores de cadenas

Cómo indexar, dividir y manipular cadenas en JavaScript Recorte de espacios en blanco

Cómo indexar, dividir y manipular cadenas en JavaScript División de cadenas

Cómo indexar, dividir y manipular cadenas en JavaScript Conversión a mayúsculas o minúsculas

Cómo indexar, dividir y manipular cadenas en JavaScript Búsqueda de la longitud de una cadena

Cómo indexar, dividir y manipular cadenas en JavaScript Acceso a los caracteres

Cómo indexar, dividir y manipular cadenas en JavaScript Las primitivas de cadena y los objetos String

How To Set Up Zoho Mail with a Custom Domain Managed by DigitalOcean DNS Conclusion Want to learn more? Join the DigitalOcean Community! Still looking for an answer?

Cómo instalar y proteger Redis en Ubuntu 18.04 Paso 5 - Renombrar comandos peligrosos

Cómo instalar y proteger Redis en Ubuntu 18.04 Paso 4 - Configurar un contraseña de Redis