In the process of developing web Apps with Docker I find these commands useful.
This command pulls an image from docker hub
1docker pull "image identifier"
list all images on the machine
list all containers on the machine
list all containers their size on disk and virtual size(the size the container and the image it’s running on)
1docker ps -s
Start a specific container on your local machine
1docker start "container name"
Stop a specific container on your local machine
1docker stop "container name"
1docker build -t imagename:tag .
The above command adds an image name and optionally a tag with such name in the build command. Note the
dot after the imagename:tag, this specifies the build context directory.
The build context is a collection of files to be used by the build process while building the docker image.
we can specify that build context should be from another path or Url then our command becomes
1docker build -t imagename:tag ./mypath
the above command specifies for path on my machine I want the build context to be.
1docker build -t imagename:tag URL
replace the URL with maybe a repository URL where you want your build context to be.
1docker build -f dockerfiles/Dockerfile.debug -t imagename:tag .
build image from a debug Dockerfile
1docker build -f dockerfiles/Dockerfile.prod -t new_imagename:tag .
build image from a production Dockerfile
1docker run -p 49161:4000 -d adeyemiadekorede/auth
Runs the container on a specific port on the background.
1docker container ls -a
List all containers on the machine