-
Notifications
You must be signed in to change notification settings - Fork 8.1k
ISSUE-22453: Update Debian, RPI, Ubuntu apt config #22454
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
Conversation
✅ Deploy Preview for docsdocker ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
thaJeztah
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if we should change this, but happy to hear if there's additional motivations here
| echo \ | ||
| "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] {{% param "download-url-base" %}} \ | ||
| $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ | ||
| $(awk -F= '/VERSION_CODENAME/ { print $2 }' /etc/os-release) stable" | \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm.. not sure I understand the change; how is this simpler than a source and echo ? The update also requires awk to be present, which would be in "most" setups, but is not guaranteed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @thaJeztah! Thank you for reviewing and commenting.
I submitted this PR and related issue because I was having some trouble using these commands in a Dockerfile to install the docker-compose-plugin inside of a devcontainer. My "fix" to use awk seemed to work and I thought it would be helpful for others. I have re-tested locally using the original $(. /etc/os-release && echo "$VERSION_CODENAME") which is now working fine for me. I very likely had some minor syntax issue causing my initial problem.
If this change doesn't make sense or is undesired I will not be offended/upset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, looking a bit further, this change is definitely not right as it would break if these would have a quote, or otherwise;
awk -F= '/PRETTY_NAME/ { print $2 }' /etc/os-release
"Debian GNU/Linux trixie/sid"
. /etc/os-release && echo $PRETTY_NAME
Debian GNU/Linux trixie/sidos-release(5) man page also describes sourcing to be the correct way; parsing in other languages is possible, but requires much more handling to make sure the values are properly consumed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on your situation, if you need to have just the docker-compose (or docker CLI) in your Dockerfile, you can also use the bin images;
To run it standalone;
# syntax=docker/dockerfile:1
# COMPOSE_VERSION is the version of compose to install in the dev container.
ARG COMPOSE_VERSION=v2.35.1
FROM docker/compose-bin:${COMPOSE_VERSION} AS compose
FROM alpine
COPY --link --from=compose /docker-compose /usr/local/bin/docker-composedocker build -t foo .
docker run --rm foo docker-compose version
Docker Compose version v2.35.1Or if you want other tools (I should warn that the buildx-bin and cli-bin images are mostly for testing purposes, but you can copy from the official docker:cli image as well);
# syntax=docker/dockerfile:1
# DOCKERCLI_VERSION is the version of the docker CLI to install in the dev container.
ARG DOCKERCLI_VERSION=28.1.1
# BUILDX_VERSION is the version of buildx to install in the dev container.
ARG BUILDX_VERSION=0.23.0
# COMPOSE_VERSION is the version of compose to install in the dev container.
ARG COMPOSE_VERSION=v2.35.1
FROM dockereng/cli-bin:${DOCKERCLI_VERSION} AS cli
FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx
FROM docker/compose-bin:${COMPOSE_VERSION} AS compose
FROM alpine
COPY --link --from=cli /docker /usr/local/bin/docker
COPY --link --from=buildx /buildx /usr/local/libexec/docker/cli-plugins/docker-buildx
COPY --link --from=compose /docker-compose /usr/local/libexec/docker/cli-plugins/docker-composedocker build -t bla .
docker run -it --rm foo docker info
Client:
Version: 28.1.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: 28c90ea
Path: /usr/local/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.35.1
Path: /usr/local/libexec/docker/cli-plugins/docker-compose
Server:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?|
Based on @thaJeztah's comments, this change is not viable or desirable so I am closing the PR and will close the related issue. |
|
Thanks! |
Description
The installation instructions for Debian, Ubuntu and Raspberry PI all use a complicated
$(. /etc/os-release && echo "VERSION_CODENAME")command to set the VERSION_CODENAME for the apt source configuration. It would be much simpler and straightforward to useawkto get this from the target file and pass to the subsequentteecommand.This commit updates the installation instructions for each of the deb-based operating systems to use
awk -F '/VERSION_CODENAME' { print $2 } /etc/os-releaseinstead of the current, somewhat confusing and complicated sourcing of the file and subsequentechoto produce the same result using a single command invocation and built-in utility (awk).Related issues or tickets
I created an issue for this before creating this PR.
#22453
Reviews