![]() The last 3 parameters are interesting, -v adds a volume to store data, for this example, it has been mapped to /tmp so all data will be lost when the machine restarts. Some environment variables have been added to make things easier. It tries to run a container from the posgres:14.1-alpine image which will be pulled in from Dockerhub by default if it does not exist.įirst, the name basic-posgres is given to the running container, and -rm will clean up the container and remove the file system when the container exits. Let’s evaluate what the above command does. ![]() To simply run the container using the Postgres 14.1 alpine image we can execute the following command: docker run -name basic-postgres -rm -e POSTGRES_USER =postgres -e POSTGRES_PASSWORD =4y7sV96vA9wv46VR -e PGDATA =/var/lib/postgresql/data/pgdata -v /tmp:/var/lib/postgresql/data -p 5432:5432 -it postgres:14.1-alpine The default bullseye version of Postgres docker image is 130 MB whereas the alpine one for the same version is 78 MB which is a lot smaller. We will be using the latest version 14.1 of PostgreSQL. Postgres with Docker #įor this post, we will use the official Postgres docker alpine image from DockerHub. Given the prerequisites have been mentioned we can move forward to the next section where we will run some docker commands. We will use an existing application/API with Node.js and Postgres replacing a remote Postgres with a local one running with Docker and Docker compose, so it would be advisable to read the previous post about it. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |