0
1

More than 3 years have passed since last update.

WindowsベースのDockerコンテナを動かす

Posted at

Windowsのコンテナを作ろう

Dockerといえば、普通はLinuxのコンテナですが、Windowsのコンテナを使いたいときもあると思います。
そんなボーイズ&ガールズにWindowsのコンテナを作るDockerfileをお贈りしよう。

GO言語の実行環境を構築

試しにGO言語の実行環境を構築してみます。
環境が変わればプレイングも変わるのが常ですが、
GOはオールラウンダーなので、さほど変わりませんから楽ですね。

FROM mcr.microsoft.com/windows:1909

ENV GOLANG_VERSION 1.14.10
ENV GOLANG_DOWNLOAD_URL "https://golang.org/dl/go$GOLANG_VERSION.windows-amd64.zip"

RUN powershell -Command \
    $ErrorActionPreference = 'Stop'; \
    (New-Object System.Net.WebClient).DownloadFile('%GOLANG_DOWNLOAD_URL%', 'go.zip') ; \
    Expand-Archive go.zip -DestinationPath c:\\ ; \
    Remove-Item go.zip -Force

RUN setx PATH %PATH%;c:\go\bin

Docker for Windowsで動かす場合は、「Switch to Windows containers」で
Windowsコンテナ稼働モードにしてください。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1