Basic and advanced docker commands for reference. Use them as a cheat sheet
- Commands to install docker on Linux
curl -fsSL https://get.docker.com -o get-docker.shsudo sh get-docker.sh
- Command to start the Docker daemon
sudo service --status-allsudo service docker start
- Command to Pull the docker images from Docker hub - https://hub.docker.com/
docker pull image_name:version
version : default value is latest
docker pull mysql
- Command to pull and install the docker image
docker run image_namedocker run mysql
docker run -d image_name => To run the command in background mode.
docker run -d --name webapp_vk -d image_name => To assign a name to the docker container
docker run -d image_name command ==> We will override the CMD statement in the image or append the value to ENTRYPOINT command.
- Command to List the running containers.
- Command to List the images present on the host.
- Command to Stop the containers.
- Command to Remove the containers.
- Command to delete or remove the images.
- Command to run and execute Unix command.
- Command to execute the scripts
- Command to build a docker image
- Command to push the docker image to Hub
- Command to pass the environment values
- Command for Port Mapping to access the applications using Docker Host IP.