Thursday, June 1, 2023

Docker Commands-Updated

  • docker -v  returns docker version 
  • docker login login to docker hub using command line
  • docker pull hello-world retrieve hello-world docker image from docker hub
  • docker run hello-world execute hello-world docker image

  • docker ps -a list all processes in docker
  • docker rmi hello-world --force delete hello-world image from docker forcefully 
  • docker rm container_id --force delete container from docker forcefully 

  • docker run -d nginx run nginx server in background
  • docker ps list running processes in docker
  • docker container inspect container_id get the all information about docker container 
  • docker run -d -p 3600:80 --name sujith-nginx nginx port forwarding with docker images execution 
  • docker exec -it container_d redis redis-cli access redis-cli after docker image execution
    • set myvalue 5 set value redis
    • get myvalue retrieve value

  • docker run -it ubuntu bash run ubuntu with bash access in docker
    • apt-get install git tree -y install git inside ubuntu
    • ctrl + p + q exit to run git in background 

  • docker container commit --author "sujith" -m "my custom image" running_container_id my_ubuntu_git_image create image using running git installed ubuntu container
  • docker docker tag my_ubuntu_git_image sujithdc/my_ubuntu_git_image tagging docker image to push to docker hub
  • docker push sujithdc/my_ubuntu_image push image to docker hub

No comments:

Post a Comment