Thursday, 1 September 2016

DOCKER

DOCKER



  • docker run -i -t ubuntu /bin/bash ---to run a docker machine
  • docker version --- to check version of docker
  • docker ps -a ---to check docker processes running
  • docker images --- to check for what docker images downloaded from hub
  • docker login --username=yourhubusername --email=youremail@company.com ---login into docker hub from cmd line
  • docker push maryatdocker/docker-whale --- to push the docker image docker into hub
  • docker rmi -f 7d9495d03763 ---to remove docker image from images use ID for the same
  • docker run yourusername/docker-whale ---to run docker images 
  • docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done" -----Let’s create a container that runs as a daemon.
  • docker logs insane_babbage --- to check the output of the demanized docker
  • docker stop insane_babbage ----docker stop command tells Docker to politely stop the running container and returns the name of the container it stopped.
  • docker ps -l --- to list processes with details
  • docker run -d -P training/webapp python app.py --- to run a python script on a docker
  • docker run -d -p 80:5000 training/webapp python app.py ---port forwarding
  • docker-machine ip default --- to check ip of default docker machine
  • docker port nostalgic_morse 5000 ----To use docker port we specify the ID or name of our container and then the port for which we need the corresponding public-facing port.
  • docker start abc--- to start the docker deamon 
  • docker rm abc--- to rm the docker deamon 
  • docker search sinatra -- to search images in hub
  • docker pull training/sinatra --- to pull an image from hub
  • docker commit -m "Added json gem" -a "Kate Smith" -----  -m and -a. The -m flag allows us to specify a commit message, much like you would with a commit on a version control system. The -a flag allows us to specify an author for our update.
  • docker push ouruser/sinatra ----to push an image to docker hub