Menu
The Tech Paper
  • Home
  • Interview Questions
    • PHP String Interview Question
    • PHP Array Interview Qutions
    • jQuery Interview Quetions
    • PHP Interviwe Question on php.ini file
    • htaccess File Interview Quetions
  • About
The Tech Paper

Docker Commands

Posted on July 3, 2020July 14, 2020
Install Docker in Linux ubuntusudo apt install docker.io
Check Docker Statussudo systemctl status docker
It provides all the information of docker, and also use to check it is installed or not. docker info
It will show a list of commands that available for us with a short description of what it does. docker –help
It will show help particularly for command with a short description of what it does.docker “cmd” –help
If an image will not available locally it will first download form the network then it will make and run the container and detach from it. docker run “Image Name”
If the image will not available locally it will first download form the network then it will make and run the container and keep it attached on it. docker run -it “Image Name”
It will open the existing container which is running. docker attach “container id”
Get in the bash terminal within a containerdocker exec -it “container id” /bin/bash
It shows only running containers. docker ps
It shows all the containers are available in dockerdocker ps -a
It shows images are available locally in the dockerdocker images
It deletes the container with a given container iddocker rm “Container id”
It deletes the images which any container is not containingdocker rmi “Image id”
It deletes the images forcefully could container containdocker rmi “Image id” –force
Download the imagedocker pull “Image Name”
To see all the running processes in Linuxps -elf(For Linux)
It will show all the running processes in the containerdocker top “container id”
Remove all container (stop container before remove) docker container prune
Stop Docker docker stop “container id”
To detach from the container without closing the container.Ctl+p then Ctl+q
Check changes in container docker diff “container id”
Check historydocker history “container id”
It will show all the commands that were associated with this Container id.docker logs “container id”
Show running container all details (Ex: IPAddress)docker inspect “container id”

Run docker and Bind mount a volume ( copy all project in docker)

docker run -dit -v source_folder:destination_folder “container id”

Example: docker run -dit -v /var/www/html:/var/www/html “container id”

-d, –detach Run container in background and print container ID

Categories

  • Docker
  • Git
  • Interview Questions
  • Laravel
  • Linux
  • php

Recent Posts

  • Ubuntu 20.04 Bluetooth not working [Resolved]
  • Git Log Commands
  • Create a swap memory in Linux
  • Hide protected files in Laravel
  • Make a bootable pendrive in Linux

Archives

  • January 2021
  • December 2020
  • September 2020
  • July 2020
  • January 2020
  • July 2019
  • August 2018
  • June 2018
  • April 2018
  • September 2017
  • June 2017
  • May 2017

Recent Posts

  • Ubuntu 20.04 Bluetooth not working [Resolved] January 22, 2021
  • Git Log Commands January 22, 2021
  • Create a swap memory in Linux December 2, 2020
  • Hide protected files in Laravel September 21, 2020
  • Make a bootable pendrive in Linux September 10, 2020

Contact Us

©2021 The Tech Paper | Powered by SuperbThemes & WordPress