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

Unattended install of Docker Desktop (Windows and macOS) #80

Closed
rfay opened this issue Apr 30, 2020 · 13 comments
Closed

Unattended install of Docker Desktop (Windows and macOS) #80

rfay opened this issue Apr 30, 2020 · 13 comments
Labels
community_new New idea raised by a community contributor docker_desktop Improvements or additions to Docker Desktop

Comments

@rfay
Copy link

rfay commented Apr 30, 2020

Tell us about your request

There are many situations, but most especially CI test runners, where Docker Desktop needs to be installed unattended. With current versions, that's either impossible or very, very sketchy.

It used to be possible on macOS using the technique in docker/for-mac#2359, but as explained in docker/for-mac#2359 (comment) it was somewhat randomly blocked by an error check on root installs in 2.1.0.0

Which service(s) is this request for?

Docker Desktop for Mac and Docker Desktop for WIndows. macOS is the place I would immediately use it.

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?

As above, in a CI environment Docker Desktop needs to be installed... by a script.

Are you currently working around the issue?

Currently using pre-2.1.0.0 version of Docker Desktop for Mac

Additional context

While I'd prefer a great solution (explicit, supported unattended install technique), I'm modestly sure that you could just remove the blocker error check, "Running Docker Desktop as root is dangerous. Please run it as a regular user"

@rfay rfay added the community_new New idea raised by a community contributor label Apr 30, 2020
@rfay rfay changed the title Automated install of Docker Desktop (Windows and macOS) Unattended install of Docker Desktop (Windows and macOS) Apr 30, 2020
@nebuk89 nebuk89 added the docker_desktop Improvements or additions to Docker Desktop label May 5, 2020
@telamonian
Copy link

+1 to this feature request, many times over. The lack of an automated install is a serious pain point for using Docker as part of a CI pipeline. This issue should also be fairly easy for the Docker team to fix, while at the same time being basically impossible to work around in a robust way from the outside. As I said in the older issue thread:

Here's a way to get a working copy of the latest Docker Desktop app for Mac installed from the command line:

#!/usr/bin/env bash

# refs:
# https://github.com/MicrosoftDocs/vsts-docs/issues/3784
# https://forums.docker.com/t/docker-for-mac-unattended-installation/27112

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

and then you can run the app and wait for it to install/set up with this script:

#!/usr/bin/env bash

# refs:
# https://stackoverflow.com/a/35979292/425458

[[ $(uname) == 'Darwin' ]] || { echo "This function only runs on macOS." >&2; exit 2; }

echo "-- Starting Docker.app, if necessary..."

open -g -a Docker.app || exit

# 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."

This is what I needed to do in order to get Docker running during my Mac CI tests (on Azure Pipelines).

My install hack above is completely ridiculous, and there should be a better way. The old way with the cute command line arguments:

/Applications/Docker.app/Contents/MacOS/Docker --quit-after-install --unattended

was so, so much better. Can we please get this back?

@telamonian
Copy link

You now need a slightly updated version of the above filthy hack in order to successfully install the very latest docker desktop for mac: docker/for-mac#2359 (comment)

@suvika17
Copy link

After updating docker to version 3.4.0, the command open -g -a Docker.app began to request privileged access: Docker Desktop needs privileged access to install its networking components and links to the Docker apps.

@telamonian, did you find a way to get around this?

satrapu added a commit to satrapu/aspnet-core-logging that referenced this issue Jun 20, 2021
Installing Docker Desktop for Mac is currently a very volatile
experience.
See more here: https://github
.com/docker/roadmap/issues/80#issuecomment-862521647.
satrapu added a commit to satrapu/aspnet-core-logging that referenced this issue Jun 20, 2021
…op for Mac (#21)

* Try installing specific Docker version on mac

* Fix docker brew formula version

* Install Docker v20.10.6

* Fix installing Docker using raw URL

Azure Pipelines reports the following error:
"Installation of docker from a GitHub commit URL is unsupported".
A possible fix is this one: https://stackoverflow.com/a/65946969/5786708
.

* Fix installing Docker using raw URL

Azure Pipelines reports the following error:
"Installation of docker from a GitHub commit URL is unsupported".
A possible fix is this one: https://stackoverflow.com/a/65946969/5786708.

* Fix brew install command

* Fix brew install command, take 2

* Install Docker legacy version which works

* Install Docker v20.10.6, take 2

* Install Docker v20.10.6, take 3

Based on this article: https://cmichel
.io/how-to-install-an-old-package-version-with-brew/.

* Install Docker v20.10.6, take 4

Based on this article: https://cmichel
.io/how-to-install-an-old-package-version-with-brew/.

* Install Docker v20.10.6, take 5

Based on this article: https://cmichel
.io/how-to-install-an-old-package-version-with-brew/.

* Install Docker v20.10.6, take 6

Based on this article: https://cmichel
.io/how-to-install-an-old-package-version-with-brew/.

* Install Docker v20.10.6, take 7

Based on this article: https://cmichel
.io/how-to-install-an-old-package-version-with-brew/.

* Install Docker v20.10.6, take 8

Based on this article: https://cmichel
.io/how-to-install-an-old-package-version-with-brew/.

* Install Docker v20.10.6, take 9

Based on this article: https://cmichel
.io/how-to-install-an-old-package-version-with-brew/.

* Install Docker v20.10.6, take 10

Based on this article: https://cmichel
.io/how-to-install-an-old-package-version-with-brew/.

* Install Docker v20.10.6, take 11

Based on this article: https://cmichel
.io/how-to-install-an-old-package-version-with-brew/.

* Install Docker v20.10.6, take 12

Based on this article: https://cmichel
.io/how-to-install-an-old-package-version-with-brew/.

* Install Docker legacy version which works, take 2

* Disable builds on macOS-based agents

Installing Docker Desktop for Mac is currently a very volatile
experience.
See more here: https://github
.com/docker/roadmap/issues/80#issuecomment-862521647.

* Remove the link pointing to macOS builds

* State the reason for disabling builds on macOS
@rdvansloten
Copy link

Any update to this? Being able to default to Windows Containers automatically during install would be appreciated for automated rollouts. Default behavior is that it is spinning up Hyper-V VMs on consumer laptops...

@laprogs
Copy link

laprogs commented Dec 13, 2021

Good morning. Is there any ETA for implementing what I described in #187 ?

@CodeCyclone
Copy link

Can you please implement --windows-containers a flag to the installer. I see there is also --settings parameter but I don't know how to use it to switch to windows containers.

Would like to avoid the warning message to install WSL2.

@nbdinara
Copy link

+1

"Can you please implement --windows-containers a flag to the installer. I see there is also --settings parameter but I don't know how to use it to switch to windows containers.

Would like to avoid the warning message to install WSL2."

@CodeCyclone
Copy link

Having a switch for accepting license agreement is also needed for this

@CodeCyclone
Copy link

Can anyone point me to the docker installer code? I assume some of these items are easier to add but it may require some plumbing through to the engine or they just require setting some config file I assume that isn't much work.

@rfay
Copy link
Author

rfay commented Mar 30, 2022

Colima works with macOS CI and you don't have this problem (and there are not license problems). https://github.com/abiosoft/colima

@rfay
Copy link
Author

rfay commented Apr 8, 2022

@stephen-turner
Copy link

As @rfay says, this is mostly fixed in 4.7.0. We don't have a switch for Windows containers yet.

@darxtorm
Copy link

+1 for the --windows-containers flag on installation.

I am currently using the SwitchDaemon method after install, but without idempotence this method is unreliable, especially when unattended installation scripts might run more than once

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community_new New idea raised by a community contributor docker_desktop Improvements or additions to Docker Desktop
Projects
None yet
Development

No branches or pull requests