Appendix

1. Running My First Docker Container

Activity 1.01: Pulling and Running the PostgreSQL Container Image from Docker Hub

Solution:

  1. To start the Postgres Docker container, first determine what environment variables are required to set the default username and password credentials for the database. Reading through the official Docker Hub page, you can see that you have configuration options for the POSTGRES_USER and POSTGRES_PASSWORD environment variables. Pass the environment variables using the -e flag. The final command to start our Postgres Docker container will be as follows:

    docker run -itd -e "POSTGRES_USER=panoramic" -e "POSTGRES_PASSWORD=trekking" postgres:12

    Running this command will start the container.

  2. Execute the docker ps ...

Get The Docker Workshop now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.