Skip to content

Instantly share code, notes, and snippets.

@ansargondal
Last active May 24, 2019 06:58
Show Gist options
  • Save ansargondal/85ca1d03f3898db166ae0925652723f7 to your computer and use it in GitHub Desktop.
Save ansargondal/85ca1d03f3898db166ae0925652723f7 to your computer and use it in GitHub Desktop.
# What is docker?
Docker is a is a containarization system in which we run an app in a container which is created by docker images.
# How to install docker?
- sudo apt-get install docker.io
- sudo systemctl start docker
- sudo systemctl enable docker
- docker --version
# Adding Docker to the User Group
- sudo groupadd docker
- sudo usermod -aG docker $USER
- Restart System
# Pulling Images from Docker Hub?
- docker pull ubuntu
- docker pull wordpress
.
.
.
- docker pull mysql
- docker images (Shows all the images)
- docker info (Shows all the info)
# What is docker-compose?
Docker compose is a tool used to compose all the individual containers at once.
# How to install Docker Compose?
- sudo apt-get install docker-compose
# How to create Project using docker-composer?
- Create a docker-compose.yml file in a directory
- Put the docker images code in to pull that image from docker hub
- sudo docker-compose up -d
- sudo docker-compose down
- sudo docker-compose down --volumes
# Removing Docker Images, Volumes & Containers?
- docker images (Shows all the images)
- docker rmi image-id (Removes a single image)
- docker rmi $(docker images -q) (Removes all the images)
- docker ps -a (Shows all the containers)
- docker rm container-id (Removes a container)
- docker rm $(docker ps -a -f status=exited -q) (Removes all the exited container)
- docker volume ls (Shows the list of volumes)
- docker volume rm volume_name (Removes the selected volume)
- docker rm -v container_name (Removes container and it's volumes)
# SSH Into Docker Container
- dokcer exec -it [container_id] bash
- docker ps (Get the id of container)
- https://gist.github.com/anonymous/a13cf604981726c8e8b0bb05a35664e2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment