Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Docker commands on Windows #1143

Closed
1 of 6 tasks
michalbarer1 opened this issue Jun 29, 2020 · 18 comments
Closed
1 of 6 tasks

Run Docker commands on Windows #1143

michalbarer1 opened this issue Jun 29, 2020 · 18 comments
Assignees
Labels
Area: Image administration documentation Improvements or additions to documentation OS: Windows

Comments

@michalbarer1
Copy link

michalbarer1 commented Jun 29, 2020

Describe the bug
I'm new to GitHub Actions and facing a few Docker related issues. I'm using Docker SDK for Python, and my tests are failing because image pull is failing. I even added a step and tried to run docker pull command via CLI, and I discovered something strange. Some pulls are working, and others just don't.
For example:
running the following step-

- name: Test Docker on Windows
        if: startsWith(runner.os, 'Windows')
        run: |
          docker pull hello-world

works just fine, but running this step-

- name: Test Docker on Windows
        if: startsWith(runner.os, 'Windows')
        run: |
          docker pull minio/minio

will cause the following error:
image operating system "linux" cannot be used on this platform
##[error]Process completed with exit code 1.

I tried to pull the same image (minio/minio) on my own windows (10 pro, not server), and this command (docker pull minio/minio) actually did work. I checked, and my configurations are standard (no experimental mode).

Area for Triage:
Scripting and command line

Question, Bug, or Feature?:
Somewhere in between a question and a bug

Virtual environments affected

  • macOS 10.15
  • Ubuntu 16.04 LTS
  • Ubuntu 18.04 LTS
  • Ubuntu 20.04 LTS
  • Windows Server 2016 R2
  • Windows Server 2019

I want to understand why I'm not able to pull some images on Windows virtual environments. Is there a way to avoid it?
Thanks :)
(If any other information is needed, please ask)

@al-cheb
Copy link
Contributor

al-cheb commented Jun 29, 2020

Hello, @michalb-dsg
Sorry we don't support Linux container on Windows Server 2016/2019, because the main requirement is Docker Desktop Enterprise. Out of the box, Docker on Windows only run Windows container. To use Linux containers on Windows Server , you need to use the Docker Desktop Enterprise which includes a full LinuxKit system for running Docker Linux containers - https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/quick-start-windows-10-linux. Another drawback is that we can not pre-install Docker Desktop Enterprise due to license policy agreement.

@michalbarer1
Copy link
Author

Hi @al-cheb
Thank you for your quick response! Is it possible to install Docker Desktop as one of my steps in CI? And after the installation, I didn't find any CLI commands for Docker Desktop in order to change some settings after installation- is it possible?

@al-cheb
Copy link
Contributor

al-cheb commented Jun 30, 2020

@michalb-dsg , Currently nope, you can't install Docker Desktop in CI due to limitations of virtual environments:

  1. Microsoft-Hyper-V component is not enabled on Windows Server 2019 image and needs reboot to enable this component
  2. DSv2 vm instance, we are currently using, doesn't support nested virtualization

@michalbarer1
Copy link
Author

michalbarer1 commented Jul 1, 2020

@al-cheb 👌
So, the same goes for MacOS, right?

@al-cheb
Copy link
Contributor

al-cheb commented Jul 1, 2020

@michalb-dsg, You can install docker and use minio/minio in runtime for macOS, because we already pre-installed virtualbox on macOS image. We can't pre-install docker on the macOS image due to license policy agreement.

jobs:
  build:
    runs-on: 'macos-latest'

    steps:
      - name: Install docker
        run: |
         mkdir -p ~/.docker/machine/cache
         curl -Lo ~/.docker/machine/cache/boot2docker.iso https://github.com/boot2docker/boot2docker/releases/download/v19.03.12/boot2docker.iso
         brew install docker docker-machine
         docker-machine create --driver virtualbox default
         docker-machine env default
      - name: Run container
        run: |
         eval "$(docker-machine env default)" 
         docker pull minio/minio
         docker container run --rm minio/minio minio --help

image

Or the second variant provided by @telamonian - docker/for-mac#2359 (comment)

  brew cask install docker
  # allow the app to run without confirmation
  xattr -d -r com.apple.quarantine /Applications/Docker.app
  
  # preemptively do docker.app's setup to avoid any gui prompts
  sudo /bin/cp /Applications/Docker.app/Contents/Library/LaunchServices/com.docker.vmnetd /Library/PrivilegedHelperTools
  sudo /bin/cp /Applications/Docker.app/Contents/Resources/com.docker.vmnetd.plist /Library/LaunchDaemons/
  sudo /bin/chmod 544 /Library/PrivilegedHelperTools/com.docker.vmnetd
  sudo /bin/chmod 644 /Library/LaunchDaemons/com.docker.vmnetd.plist
  sudo /bin/launchctl load /Library/LaunchDaemons/com.docker.vmnetd.plist
  open -g -a Docker.app
  
  # Wait for the server to start up, if applicable.
  i=0
  while ! docker system info &>/dev/null; do
    (( i++ == 0 )) && printf %s '-- Waiting for Docker to finish starting up...' || printf '.'
    sleep 1
  done
  (( i )) && printf '\n'
  
  echo "-- Docker is ready."

@al-cheb
Copy link
Contributor

al-cheb commented Jul 6, 2020

Feel free to open the thread if you have any concerns.

@ItalyPaleAle
Copy link

@al-cheb now that Docker on Windows can use WSL to run Linux containers, is it possible to maybe reopen this?

@al-cheb
Copy link
Contributor

al-cheb commented Sep 7, 2020

@ItalyPaleAle, WSL2 doesn't support current - OS Version: 10.0.17763 Build 1397

@mkreidenweis
Copy link

@al-cheb Are the plans to upgrade the OS Version to support WSL2, or is this not possible for some reason?

@al-cheb
Copy link
Contributor

al-cheb commented Sep 25, 2020

@alepauly, Do we have any plans to update Windows Server 2019?

@thedrow
Copy link

thedrow commented Feb 28, 2021

@alepauly, Do we have any plans to update Windows Server 2019?

That would be most helpful.

@h0p3zZ
Copy link

h0p3zZ commented Nov 18, 2021

@al-cheb is WSL2 enabled on windows-latest?

@h0p3zZ
Copy link

h0p3zZ commented Nov 18, 2021

The ability to run docker on windows via WSL would be great, because if you need smth. like Electron (as we do) with a windows-build you could still use it.

@catthehacker
Copy link
Contributor

catthehacker commented Nov 18, 2021

@h0p3zZ WSL2 has been removed from Windows Server 2022 so it's not possible to run Linux containers in WSL
See microsoft/WSL#6301 (comment)

@h0p3zZ
Copy link

h0p3zZ commented Nov 18, 2021

@h0p3zZ WSL2 has been removed from Windows Server 2022 so it's not possible to run Linux containers in WSL See microsoft/WSL#6301 (comment)

Alright... yeah thats real bad :D - still thanks though.

Still... is there a way we can achieve the usecase I mentioned earlier?

@catthehacker
Copy link
Contributor

Not sure what are you trying to do, but Electron should work normally through NodeJS

@h0p3zZ
Copy link

h0p3zZ commented Nov 18, 2021

@catthehacker I'm trying to run the spectron tests in an Action. But when I try to run this in ubuntu-latest it does not work at all. In windows all tests pass in ubuntu none do.

Therefore the request.

dtrifiro added a commit to iterative/pytest-servers that referenced this issue Aug 22, 2022
dtrifiro added a commit to iterative/pytest-servers that referenced this issue Aug 22, 2022
dtrifiro added a commit to iterative/pytest-servers that referenced this issue Aug 22, 2022
undergroundwires added a commit to undergroundwires/privacy.sexy that referenced this issue Sep 27, 2023
This commit improves multiple aspects of Docker builds:

- Enable artifact output validation for Dockerfile.
- Correct the path references in Dockerfile for the distribution
  directory.
- Add Dockerfile specific indentation rules to `.editorconfig`.
- Use `npm run install-deps` for dependency installation, enhancing
  build reliability.
- Add automation script `verify-web-server-status.js` to verify running
  web server on given URL.
- Introduce automated build verification for Dockerfile:
  - On macOS, install Docker with colima as the container runtime
    because default agents do not include Docker and Docker runtime is
    not installed due to licensing issues (see actions/runner-images#17).
  - On Windows, there's no Linux container support (actions/runner#904,
    actions/runner-images#1143), so keep the checks for macOS and Ubuntu
    only.
LarrMarburger added a commit to LarrMarburger/privacy.sexy that referenced this issue Nov 16, 2023
This commit improves multiple aspects of Docker builds:

- Enable artifact output validation for Dockerfile.
- Correct the path references in Dockerfile for the distribution
  directory.
- Add Dockerfile specific indentation rules to `.editorconfig`.
- Use `npm run install-deps` for dependency installation, enhancing
  build reliability.
- Add automation script `verify-web-server-status.js` to verify running
  web server on given URL.
- Introduce automated build verification for Dockerfile:
  - On macOS, install Docker with colima as the container runtime
    because default agents do not include Docker and Docker runtime is
    not installed due to licensing issues (see actions/runner-images#17).
  - On Windows, there's no Linux container support (actions/runner#904,
    actions/runner-images#1143), so keep the checks for macOS and Ubuntu
    only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Image administration documentation Improvements or additions to documentation OS: Windows
Projects
None yet
Development

No branches or pull requests

8 participants