This tutorial use Ubuntu/Debian base systems. If you use another system, you can adapt.
First open your terminal and run
sudo apt update && apt install docker.io
Now, docker is installed on your machine.
To enable and start docker services, run
sudo systemctl start docker && sudo systemctl enable docker
If you want to stop the docker,
sudo systemctl stop docker && sudo service docker stop
Now we're going to install Postgres docker image, for this, run the follow command on terminal:
sudo docker run --name container_name -e POSTGRES_PASSWORD=badatabse_password -p 5432:5432 -d postgres
Note, if you already installed Postgres database in your system, the port 5432 is already booked, then you can change to another number port for example,
5434:5432
If everything goes well, docker is running in your machine.
Helpful commands
Show all docker containers running:
sudo docker ps
Show all docker containers:
sudo docker ps -a
Start docker container by name:
sudo docker start container_name
Stop docker container by name:
sudo docker stop container_name
That`s all folks!
Top comments (0)