gjshah7254
1/8/2019 - 1:38 AM

Docker Helpful Commands

##Shows all docker images on your machine
  docker images

##Start the build for installing this docker image
  docker build -t mongodb-xdb:v1 .

##remove docker image from your machine
  docker rmi 135a79342ba1

##remove docker image session from your machine
  docker rm 135a79342ba1

##Status of running sessions of docker images
  docker ps -a

##Stop an instance of docker image
  docker stop 4aa7fd591198

##Run a new instance of docker image
  docker run -d -p 8001:27017 mongodb-xdb:v1

##Shows help info for the docker file
  type .\build_docker.bat

##find session logs
  docker logs -f 35a42e013000

##Pull an image from Docker hub
  docker pull 10.38.11.73:5000/bunnings/redis:v1

##Pull an image from Azure container registry:
  docker login akqashared.azurecr.io --username akqashared --password fiwufhweo3 ##password and username are found in container registry in access keys section
  docker pull akqashared.azurecr.io/dotnet_core_base_image:20H2

##Push an image from Docker hub
  docker push 10.38.11.73:5000/bunnings/redis:v1

##Push and image to azure container registry:
  docker-compose up -d --build DOTNET_Base_Image
  docker login akqashared.azurecr.io --username akqashared --password fiwufhweo3 ##password and username are found in container registry in access keys section
  docker tag 34d29d2d87d9 akqashared.azurecr.io/resero/dotnet_base_image:ltsc2019
  docker push akqashared.azurecr.io/resero/dotnet_base_image:ltsc2019

##Docker Exec to trigger a executable code in the container. Below line triggers a PS1 file in container
  docker exec CONTAINER-NAME powershell "$mountPath\bootstrap-website-databases.ps1"
  docker exec CONTAINER-NAME powershell -Command "dir 'c:/Program Files (x86)/MSBUILD/Microsoft'"

##Copy data from your local folder to docker Image by DockerFile
  COPY ["MSBUILD", "C:/Program Files (x86)/MSBUILD"]
  COPY ["././bootstrap-website-iis.ps1", "C:/temp/bootstrap-website-iis.ps1"]

##To stop all container and delete all the images:
  docker kill $(docker ps -q)
  docker rm $(docker ps -a -q)
  docker rmi -f $(docker images -a -q)
  docker images -q | ForEach-Object { docker rmi -f $_ } ##Tested script
  docker system prune -af ## Tested Script - removes, Containers, Network & Images

##Restart IIS App pool in a docker POD
	import-module webadministration;restart-webapppool defaultapppool
	Get-IISSite "Default Web Site"

##Ping the site inside container/pod
	iwr http://localhost -usebasicparsing
	
##Simple Vim workflow
	#Open a new or existing file with vim filename.
	#Type i to switch into insert mode so that you can start editing the file.
	#Enter or modify the text with your file.
	#Once you're done, press the escape key Esc to get out of insert mode and back to command mode.
	#Type :wq to save and exit your file.

	#Example:
	vim ./App_Config/Include/Coveo/Coveo.SearchProvider.Custom.config