Docker
Common commands
Show the current docker image running
sudo docker ps
Show the images available
sudo docker images
Stop a container id
sudo docker stop <container id>
Start a container id
sudo docker stop <container id>
Show ports exposed
sudo docker port <container id>
List current containers
sudo docker container ls -s
Remove a container
sudo docker container rm <container id>
Creating a docker postgres image
This exposes the default port 5432 for postgres
docker run --name postgresq-spring -e POSTGRES_USER=iain -e POSTGRES_PASSWORD=password -p 5432:5432 -v /data:/var/lib/postgresql/data -d postgres:alpine
The -d is to run the container in the background
The postgres:alpine is the image name
The -p is the port to expose which is the default for postgress
The -v is where the data will be stored