11/25/2023 0 Comments Postgres 13 docker![]() –name – This is a name you can use in docker commands to refer to the container.Here is a list of what I provided in the command at the beginning: The basic command for starting the container requires a few parameters. You could do this without the folder above, but your data would be in the container and if the container were ever deleted, then the data is lost. Once we have the image, we can start the container. I assume you are working with the default Docker registry, so this command should work: Docker image pull postgres:latest You can see that since it say “Switch to Windows containers”. I used Windows 10, and I have WSL v2, as you can see:ĭocker Desktop is running Linux containers. I won’t cover installing Docker or setting up Linux containers, but you do need to do this. It should be empty.Ĭontainer images are available from Docker. This is the place we’ll keep data for this PostgreSQL container. Now create a pgdev folder under c:\docker. This is a good spot for any Docker related volumes. ![]() Then if the container dies, we can map this to another PostgreSQL container and have our data appear.Ĭreate a c:\Docker folder on your machine. This will be a volume for our container, which we will map to a particular location inside the container. We want to keep data around, so let’s make a place for this. Then you have a PostgreSQL instance running on port 5432 (default) with a user, postgresql, and a password, detailed instructions below Create a place for dataĬontainers are ephemeral, which isn’t what we want for a database. get the Docker image: docker pull postgresql:latestĭocker run -name pgdev -e -d -p 5432:5432 -v C:\Docker\pgdev:/var/lib/postgresql/data postgres.I’ve seen a few posts, but I had to cobble together some instructions from places, so I decided to make my own post to help me remember and keep things simple. This post looks at how to set up a PostgreSQL container on Windows using Docker for Windows.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |