Docker: Difference between revisions
Jump to navigation
Jump to search
Created page with "== 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>..." |
No edit summary |
||
Line 1: | Line 1: | ||
== Common commands | == Common commands == | ||
Show the current docker image running | Show the current docker image running | ||
Line 22: | Line 22: | ||
sudo docker container rm <container id> | sudo docker container rm <container id> | ||
== Creating a docker postgres image | == Creating a docker postgres image == | ||
This exposes the default port 5432 for postgres | 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 | 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 |
Revision as of 21:56, 13 May 2020
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