Please note that the Docker image and container identifiers used in the following examples will need to be updated with the values from your own environment.
Run a Sitecore container based on an image:
docker run -d -m 8GB --name <ContainerName> <ImageNameOrID>
Examples:
docker run -d -m 8GB -p 80 -p 443 -p8983 --name test dockerhub.io/lfaggiani/sitecore-xpsingle:9.0.2.180604-windowsservercore-ltsc2016'
Or
docker run -d -m 8GB -p 80 -p 443 -p8983 --name test 846c823a2572
Access to the Sitecore instance that is running in the container
You can access the Sitecore instance from your computer with your preferred browser by following these steps:
Get the container IP
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}' <ContainerNameOrId>
Or
docker exec <ContainerNameOrId> ipconfig
Examples:
docker exec test ipconfig
docker exec 5bfbd811908f ipconfig
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}' test
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}' 5bfbd811908f
Update the local "host" file with the following entries
<ContainerIP> habitat.dev.local
<ContainerIP> habitat_xconnect.dev.local
Examples:
172.19.118.233 habitat.dev.local
172.19.118.233 habitat_xconnect.dev.local
Browse to any of the following URLs
The first time may take some time as Sitecore has to warm up:
https://habitat_xconnect.dev.local/
http://habitat.dev.local/
https://habitat.dev.local/
If no changes have been done in the build files, the domain names must be literal.
Troubleshooting the container with PowerShell
Connect to a running container with a PowerShell console
docker exec -it <ContainerNameOrId> powershell
Examples:
docker exec -it test powershell
docker exec -it 5bfbd811908f powershell
Run a container with a volume that allows you to copy the Sitecore and IIS logs, and other data out of the container
docker run -d -m 8GB -p 80 -p 443 -p8983 -v E:\Debug:C:\Debug --name <ContainerName> <ImageNameOrID>
Examples:
docker run -d -m 8GB -p 80 -p 443 -p8983 -v E:\Debug:C:\Debug --name test 'dockerhub.io/lfaggiani/sitecore-xpsingle:9.0.2.180604-windowsservercore-ltsc2016'
docker run -d -m 8GB -p 80 -p 443 -p8983 -v E:\Debug:C:\Debug --name test 846c823a2572
Once the container is running, you can connect with a PowerShell console as described above. Inside the container, anyting that is copied to the folder C:\Debug will be automatically saved in the container's host in "E:\Debug".