Skip to content

Instantly share code, notes, and snippets.

@SWBSanjeewa
Last active August 28, 2018 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save SWBSanjeewa/794f1ba8508cec7679c7db88b87fc6dd to your computer and use it in GitHub Desktop.
Save SWBSanjeewa/794f1ba8508cec7679c7db88b87fc6dd to your computer and use it in GitHub Desktop.
Install docker on ubuntu
>apt install docker.io
Install docker-compose on ubuntu
>apt install docker-compose
Build Image
>docker build . -t <image_name>
Run container
>docker run -it <image_name>
Connect to running container
>docker exec -it <container_id> <process_name>
Linux docker container open bash command with interactive terminal
docker exec -it 0b4560b0788c bash
Windows docker container open powershell with interactive terminal
docker exec -it 0b4560b0788c powershell
List running containers
>docker ps
List all containers(running, stopped)
>docker ps -a
List all containers with no truncate output
>docker ps --no-trunc
List all images
>docker images
Remove images
>docker rmi <image1> <image2>
List untagged images
>docker images -f dangling=true
Delete untagged images
>docker rmi $(docker images -f dangling=true -q)
Docker compose build
>docker-compose -f docker-compose.yml up -d
Docker compose remove containers
>docker-compose -f docker-compose.yml stop
Log into docker domain
>docker login docker.abc.com
Enter username and password, "Login Succeeded" message should be appear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment