Docker common command

Docker Common Command

docker images
docker images -a
docker rmi <imagename>

docker run -d -p 4000:80 friendlyname
docker run -d -p 4000:80 username/repository:tag
docker run -it jameslee/debian:1.00
docker ps
docker ps -a
docker kill <hash>
docker rm <hash>
docker exec -it <container> bash
docker inspect <container_id>

-Way to build docker images
+Docker commit command
Step1: Spin up a container from a base image

Docker run -it debian:jessie

Step2: Install git package in the container
apt-get update && apt-get install -y git

Step3: Commit changes made in the container
docker commit <comtainerid> jameslee/debian:1.00

Step4: check
docker run -it jameslee/debian:1.00
+Writing Dockerfile

docker build -t friendlyhello .

-Push docker to Docker Hub
+ Sign up a account
+ Follow these steps:
docker login
docker tag <nameimage> username/repository:tag
docker push username/repository:tag
-Docker Compose
docker-compose up -d
docker-compose stop
docker-compose rm
docker-compose logs
docker-compose logs -f
docker-compose logs <name container>
docker-compose build