Docker - siddaram217/Docker-OpenShift GitHub Wiki

Docker : =>Why docker -optimize the compatibility -docker use common OS kerlen =>Contains are the running instances of docker image that are isolated & have there own environment & set of processes

Docker commands : =>list images ->docker images =>list all running process ->docker ps --all(list all stopped and running processes as well) =>build docker -> docker build .(current directory) =>docker run -> docker run -d -p 8081:8080 : -d indicates the detached mode return to console. -p : mapping the docker internal port to external port for access. =>docker -a - attach to go back to attach mode or docker process =>docker run -i "docker command"
-i to provide standard input to docker image => docker run -u -u to specify the username for running the docker image => docker run -it -it to accept the input from terminal => docker run -e = -e to specify the environment variables => docker pull <image_id>/<image_name> pull to only download image. will not run the image => docker exec <container_id> exec to run command in running container => docker rm <container_id> rm to remove stopped container => docker rmi <image_id> rmi to remove image

=> For access the docker running image we can use the docker ip/container ip with provided external port -If running in local machine we can use http://localhost:

=>Mapping volume

  • docker image is immutable and whenever we run multiple instances data in one instance can not be shared with another image so to store data permanently we can map the out side directory to inside the image => like for mysql -docker run -v /opt/data-dir:/var/lib mysql -docker run -n :

=>docker file details

  • docker file starts with FROM keyword
  • docker file contains 2 things one is instruction and another one is argument FROM/RUN/COPY ubuntu/apt-getupdate/abc.txt

=>docker history - history command to check the docker image installation/commands execution history of that image

=> While docker build if any step/installation/instruction fails then if we rerun the docker image then it will start the execution from failed steps remaining it will take from docker cache.

=>Docker compose File : - docker compose is useful when we are running multiple docker images - image could be already build or available in docker hub.(docker hub is the public repository for the docker images) - We also specify the image specific configurations to each image like port,volume etc. => To start and stop docker compose

  • docker-compose up <docker-compose.yml, docker-compose.yaml> specify the yml file for running the docker compose.
  • docker-compose stop

Docker Udemy example ans : https://github.com/mmumshad/docker-training-answer-keys https://hub.docker.com/r/mmumshad/ansible-playable/ https://github.com/mmumshad/ansible-playable/blob/master/Dockerfile https://www.callicoder.com/spring-boot-mysql-react-docker-compose-example https://www.tecmint.com/install-apache-web-server-in-a-docker-container/ https://github.com/nishanttotla/DockerStaticSite

https://www.middlewareinventory.com/blog/docker-reverse-proxy-docker-apache-webserver-example/

⚠️ **GitHub.com Fallback** ⚠️