docker-install
docker-install copied to clipboard
why to sleep for 20 seconds?
I see this line https://github.com/docker/docker-install/blob/2e839c9ac3e469baedcf74069d0e95200957d332/install.sh#L265 and also others. I don't really understand why should I sleep for 20 sec?
Because otherwise the user wouldn't be able to act on the warnings that are printed; https://github.com/docker/docker-install/blob/2e839c9ac3e469baedcf74069d0e95200957d332/install.sh#L237-L258
Oh, I was using this script in my dotfiles, and thought that I wait too long
I use the script in a similar way and actually think it would be nice to be able to bypass the sleep by setting an environment variable or passing a flag or something.
What's the reason you're getting the error? If you're using the script to update to a newer version, using the regular way to update packages (apt-get update && apt-get install -y docker-ce docker-ce-cli containerd.io, or the equivalent yum/dnf commands) might be better
The sleep happens when this condition is met https://github.com/docker/docker-install/blob/2e839c9ac3e469baedcf74069d0e95200957d332/install.sh#L221 even though one of the potential scenarios already accounted for displays a message informing the user they can safely ignore the message https://github.com/docker/docker-install/blob/2e839c9ac3e469baedcf74069d0e95200957d332/install.sh#L257 in which scenario I would ideally want the option to also skip the sleep when calling this script as part of another script's installation procedure. 20 seconds isn't hurting anyone, but if the option to skip it is being considered I can confirm it would be useful and would be used.
Also just to clarify, what I'm asking is along the lines of setting an environment variable prior to running the script that would be something like SKIP_DOCKER_CE_INSTALL_SLEEP_WARNING=true or something that's very intentional. I would also consider some kind of flag when running like bash docker-install.sh --skip-sleep-when-docker-already-exists=true (maybe not that long as a flag, but point being it wouldn't be something passed on accident like -s).
Oh, I was using this script in my dotfiles,
I'm still curious when the script is called / used in your use-case to get a better understanding; Is it to keep your docker installation up-to-date? How do you keep other packages up to date (and wouldn't docker be included in the same process?)
informing the user they can safely ignore the message
So, first of all, situations where I think this scenario can be problematic (and where the script is not suitable for updating);
- If the
dockercommand was detected, but a different package is installed (either a distro package, or perhaps podman and people setalias docker=podman). In this case, the warning definitely should not be ignored. - I think the script actually needs an update to account for the fact that it's no longer installing a single package, but multiple (cli, daemon, containers), to make the "update" scenario work correctly; the current script only explicitly installs
docker-ce, and relies on the dependencies defined in the.deb/.rpmpackages to install the CLI and containerd. This works ok for the "fresh" install case (due to the dependency chain), but could lead to thedocker-ce-cliandcontainerd.iopackages not being updated on existing installs; https://github.com/docker/docker-install/blob/2e839c9ac3e469baedcf74069d0e95200957d332/install.sh#L406 - After upgrading the system (although this is not specific to the script); if, for example, I upgrade my Ubuntu 18.04 machine to Ubuntu 20.04, the package repositories added by the script would still point to the 18.04 package repositories. To make the script work well for upgrading/updating, that should probably be addressed.
Also just to clarify, what I'm asking is along the lines of setting an environment variable prior to running the script that would be something like SKIP_DOCKER_CE_INSTALL_SLEEP_WARNING=true or something that's very intentional. I would also consider some kind of flag when running like bash docker-install.sh --skip-sleep-when-docker-already-exists=true (maybe not that long as a flag, but point being it wouldn't be something passed on accident like -s).
Perhaps it could looks for DEBIAN_FRONTEND=noninteractive and/or similar options for rpm-based platforms. I do think that ideally the points above would be addressed though, otherwise the script would not work well for the upgrade scenario, and I'd rather have a warning then this being ignored "silently"
@tianon any thoughts?
same issue +1. I need a flag to skip this sleeping.
@tianon any thoughts?
I mean, you know my thoughts on this script... :sweat_smile:
(I would've deprecated it years ago - I think it does more harm than good. :innocent:)
The idea of folks using it inside their dotfiles is honestly kind of terrifying, and I'd love to hear more about the intended use case too.
I also have a use case for this - creating an azure devops agent docker file where I need to install docker within the docker image
+1 - we're installing docker inside a dotnet/core Linux image so that we can build and push the .NET projects to docker.
It's giving me a warning that WSL is detected and pauses for 20 seconds during the docker compose - would be nice to be able to avoid the 20s
curl -fsSL https://get.docker.com | awk -v new_command_exists_function='command_exists() { if [ "$1" = "docker" ]; then return 1; else command -v "$@" > /dev/null 2>&1; fi }' '/^command_exists/,/^\}/ { if ( $0 ~ /\}/ ) print new_command_exists_function; next } 1' | sh
Replaces the command_exists function with a one that returns non-zero if the commmand to check for is docker.
Maybe this helps?