I have named mine docker-compose.yml in this demo. You can copy the code from above into your own docker compose file. Below are the credentials inside the compose file for demo purposes. You can set the credentials as per your needs. This way I can share the compose files with other developers without them knowing my credentials. I always configure sensitive data inside the environment variables to make sure they are not exposed inside a compose file. Normally all data is in memory inside the container, but this way we can persist it. By doing this you won't lose your data if the container is restarted. It includes a volume section to automatically generate a local volume (path) for your database data. It is very easy to get started with PostgreSQL when you specify your infrastructure as code using Docker Compose.īelow is a full docker-compose.yml file showing you how to get PostgreSQL up and running easily. How to run PostgreSQL using Docker Compose? If you are working the smart way ( work smart not hard) you incorporate the database into your CI/CD pipeline to make sure that there is always a database associated with your application and the other developers on your team will also have access to test new features on their development machine without having to download and install tons of software locally. You can scale them easily and adapt to your user's needs without having to change the whole architecture of your hosting environment. Running your databases in containers is very ideal both in the development environment, but also in production. ![]() By the end you will be able to use Docker and Docker Compose to run your very own PostgreSQL database. This article will be short, but very straightforward and easy to follow. It is very easy to get started with PostgreSQL on Docker with just a few simple commands. ![]() ![]() If you are not running a Windows machine and you need to run a PostgreSQL database on either macOS or Linux, you could go with Docker.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |