Sobes.tech
Middle

What do you know about Docker and Kubernetes? How did you install and run PostgreSQL in Docker?

sobes.tech AI

Answer from AI

Docker is a platform for containerizing applications, allowing you to package an application and all its dependencies into an isolated container.

Kubernetes is a container orchestration system that manages deployment, scaling, and maintenance of containerized applications in a cluster.

To install and run PostgreSQL in Docker, the official image from Docker Hub is usually used. Example of running:

docker pull postgres

docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d postgres

This will create and run a container with PostgreSQL, accessible on the local port 5432. For more complex scenarios, Docker Compose can be used, where parameters for data storage volumes, environment variables, and network settings are specified.