The idea: run the .NET Core simple application (hello world) in a Linux container provisioned by Docker ecosystem.
The prerequisites: docker engine installed. I’ve already had Docker Toolbox installed from my previous experiments, the version, however, was a little bit obsolete. So I downloaded new one, installed and tried docker CLI tools to find what is running. Nothing was.
I have had a VirtualBox's VM for hosting containers, but it was in a “Saved” state and unwilling to change it. Even removal from command line didn’t work, so I removed it through VirtualBox’s interface. Then I tried to create a new one with CLI, it failed and after short googling I found the answer in the Hanselman’s post. I switched to the newly created boot configuration and voila, up and running (here and below I use Powershell):
It is not enough to be able to connect to that machine, “docker” commands were not able to do anything:
The truth is, the docker machine needs to be configured – the “docker-machine env default” command gives what you need to run to be able to connect. This configuration would have to be done for each terminal session:
I tried to run one small container (BusyBox) and that succeeded:
The app – I needed something to run, so I created it:
Then I needed the binaries, dotnet publish will do the job. Here I am doing publishing into ‘app’ folder:
The next step – create a container from binaries.
docker needs a config file for the container composition, here is mine (should be named “dockerfile” in project root folder):
FROM microsoft/dotnet:1.0.0-rc2-core3 commands, and your container is ready:
WORKDIR /app
COPY /app /app
ENTRYPOINT dotnet dockerhello.dll
But not running. It appeared to be a error in config file – the casing for the files matters, here is the corrected line:
ENTRYPOINT dotnet dockerHello.dllShort fix and here it is:
I also wanted to try https://beta.docker.com/ and run without VirtualBox – using Hyper-V, but that’s probably for the next time.
2 comments:
Thank you for beinng you
Post a Comment