Basic Business Central Docker Commands That I Use

 Open Powershell / Powershell ISE on HOST machine using Run As Administrator  

   
 
 NOTE: When referring to a Container ID or Image ID, you can use the first 
       few characters of the ID if they are unique--you do not have to always
       use the full ID.


 Check NavContainerHelper Version  
   
      Get-InstalledModule NavContainerHelper  
   
   
 Fresh Install of NavContainerHelper  
   
      Install-module navcontainerhelper  
      Import-Module navcontainerhelper  
   
   
 Install Latest NavContainerHelper  
   
 If you KNOW you don't have multiple versions installed:  
   
      Update-Module NavContainerHelper -Force  
   
 If you MIGHT have multiple versions installed:  
   
      $MyModuleName = <modulename>  
      Uninstall-Module $MyModuleName -allversions   
      Install-Module $MyModuleName
   
      NOTE: I do not recommend using the -Force option with Install-Module. 
            It can bypass valuable warnings that you want to know about.


 Alternate method to Remove Old Versions of NavContainerHelper  
   
      $ModuleName = 'navcontainerhelper';  
      $Latest = Get-InstalledModule $ModuleName;   
      Get-InstalledModule $ModuleName -AllVersions | ? {$_.Version -ne $Latest.Version} | Uninstall-Module -WhatIf  
   
   
   
 Container Management Commands  
   
   	Compact Container listing:
    
      docker ps --format "table {{.Names}}\t{{.ID}}\t{{.CreatedAt}}\t{{.Status}}"
      
    Full listing:
    
      docker ps  
      docker ps -a  
        
      docker start <id>  
      docker stop <id>  
   
      
      docker container inspect 


 Remove Container  
   
    Recommended method:

      Remove-BCContainer <containername>


    Manual Docker method:

      docker stop <id> 
      docker rm <id> 
      Manually clean up hosts file
      Manually remove desktop icons
      Manually remove extensions from C:\ProgramData\NavContainerHelper\Extensions\
   

 Stop all running containers:  
        
      docker stop $(docker ps -aq)  
   
   
 Images  
   
       docker images  
       docker images -a  
   
 Remove Image  
   
      docker rmi <id>  
        
      docker rmi <repository>:<tag>  
   
   Remove all images:

      docker rmi $(docker images -aq)

   
 Clean up old images  
   
   Remove orphaned images with "< none >" identifiers:

      docker images -q -f dangling=true | % { docker rmi $_ }  


   Remove orphaned images:
   
   	  docker image prune -f
      
   Remove orphaned AND UNUSED images:
   
   WARNING: Be careful with this: It will remove generic OS images used by NavContainerHelper!

      docker image prune -a -f
   

   
 Get Artifact Info for an existing BC Container:  
   
      Get-BcContainerArtifactUrl containername  
        
      Get-NavContainerArtifactUrl containername  
   
   
 Diagnostics  
   
      Get-BcContainerEventLog  
   
   
   
 Create New BC Container  
   
      New-BcContainerWizard  
   
   
 https://blog.baudson.de/blog/stop-and-remove-all-docker-containers-and-images  

No comments:

Post a Comment