After we have started the Docker daemon, we can run Docker commands without daemon connection errors:
- Let's pull and start the PostgREST image from Docker as shown here:
[root@ip-172-31-95-213 src]# docker run --name tutorial -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -d postgres
This will run the Docker instance as a daemon and expose port 5432 to the host system so that it looks like an ordinary PostgreSQL server to the rest of the system, as shown in Figure 6.2:
Figure 6.2 – Pulling a PostgREST image from Docker
- Next, we will connect to the SQL console (psql) inside the container with the help of the following command:
[root@ip-172-31-95-213 src]# docker exec -it tutorial psql -U postgres
psql (11.5 (Debian 11.5-1.pgdg90+1))
Type "help" for help.
postgres=#
Once the preceding command is executed, we will see the psql command prompt. You can start to create your database schema and tables here so that later...