7. Docker Storage
Activity 7.01: Storing Container Event (State) Data on a PostgreSQL Database
Solution:
- Run the following commands to remove all the objects in your host:
$ docker container rm -fv $(docker container ls -aq) $docker image rm $(docker image ls -q)
- Get the volume names, and then remove all the volumes using the following commands:
$docker volume ls $docker volume rm <volume names separated by spaces>
- Get the network names and then remove all the networks using the following commands:
$docker network ls $docker network rm <network names separated by spaces>
- Open two terminals, one dedicated to seeing
docker events --format '{{json .}}'
in effect. The other one should be opened to execute the previously mentioned high-level steps. - In the first terminal, run the following command:
docker events --format '{{json .}}'.
You should get an output like the following: