OK, we’ve got Docker running locally, we’ve gotten our first image from Microsoft (thanks, Satya!) and we’re ready to go gangbusters on some Images. We’re going to need a Dockerfile. Essentially a Dockerfile (no extension) is a set of instructions on how to compose an image. It has arguments you can pass in, and things it does. Let’s look at one of the more simple ones, the Sitecore Assets Image.

The Sitecore Assets Image is meant to ingest all the files and utilities you’ll need for most any Image you compose down the dependency tree. It contains stuff like NuGet, 7-Zip, Sitecore WDPs, etc. Let’s go:

1. Head over to the Repo and clone it

The community has started a great repository on GitHub. Head there to check it out: https://github.com/Sitecore/docker-images. Once you’re done, clone it locally.

git init
git remote add origin https://github.com/Sitecore/docker-images.git
git pull origin master
git checkout c6011998ec19a4689b7646f86114fcb4a11aa47c #This repo is ever-changing....this commit works!
You should see this, if you didn’t misspell “git”

2. Ensure all your WDPs are present

This is almost certainly going to change, but as of this writing, you need to ensure that your Dockerfile is a sibling of all your WDPs. This is what your \windows\9.2.0\sitecore-assets folder should look like:

3. Run It

Wait, are you sure? Yes. I’m sure. Trust me on this one. It’s ok to be scared. For reals it is. Just run this from the same path as above. I’ll hold your hand:

docker image build --build-arg BUILD_IMAGE=mcr.microsoft.com/windows/servercore:1903 --build-arg BASE_IMAGE=mcr.microsoft.com/windows/nanoserver:1903 --tag sitecore-assets:9.2.0-nanoserver-1903 --isolation 'hyperv' .\windows\9.2.0\sitecore-assets\

You’re going to see a flurry of activity, and finally end back up at the command prompt.

  • If you saw a “COPY failed: no source files were specified” then that means you didn’t have your WDPs parallel to the Dockerfile. It’s ok, try again when they’re there.
  • If you saw a note about “Exactly one Argument” don’t forget the path argument at the end. It matters. Also, all your parameters/options should have a double hyphen in front and a space in between, such as “–build-arg NAME:value”
  • If you saw something regarding “curl: (6) Could not resolve host: dist.nuget.org” then you haven’t updated the docker daemon DNS. Go back a step and look for the DNS update portion. Don’t forget to restart Docker Desktop.

After about 18 steps, you’ll see the prompt again and when you list your docker images (docker image ls) you’ll see our new image in place

That’s pretty. Isn’t it? ISN’T IT?!?

If you’re curious about the layers that went into that layer, check out

 docker image history 269be2b4423

And for an even nerdier deep dive into the innards of the hotdog, try inspect:

 docker image inspect 269be2b4423

You probably feel a little guilty running something and not knowing what it’s doing? Oh, you don’t? Well you should. How about you feel better about this whole thing and move on to Part 5: Deconstructing a Dockerfile.

The TL;DR

#initialize your git repo and create the assets image
git init
git remote add origin https://github.com/Sitecore/docker-images.git
git pull origin master
docker image build --build-arg BUILD_IMAGE=mcr.microsoft.com/windows/servercore:1903 --build-arg BASE_IMAGE=mcr.microsoft.com/windows/nanoserver:1903 --tag sitecore-assets:9.2.0-nanoserver-1903 --isolation 'hyperv' .\windows\9.2.0\sitecore-assets\

This is a post in the “Yet Another Sitecore Docker Series.” Other Posts include


Facebooktwitterredditlinkedinmail Facebooktwitterredditlinkedinmail