canonical / docker-snap

https://snapcraft.io/docker
MIT License
54 stars 27 forks source link

Why is this version so old? #155

Open RichardJECooke opened 1 year ago

RichardJECooke commented 1 year ago

Docker in snap is version 20. The latest Docker official is version 24. Why is this app so old in snap? I thought snaps were supposed to be kept up to date with the latest stable version of all apps

jocado commented 1 year ago

I can't give the any eta, but there is an open PR for a branch that updates to version 24, https://github.com/docker-snap/docker-snap/pull/152 , when that is merged it will partially solve this issue. It still has to be promoted to stable, and I don't know if there will be any channel changes to support the significant version bump.

wordjelly commented 1 year ago

Hi, With the latest version of golang, all docker compose commands fail, because this snap includes docker 20. The issue is resolved in docker 24.x . Can I please request you to merge this commit at soonest and push the snap to the central repository. This has started breaking all docker compose files, across installations and platforms.

jocado commented 1 year ago

CC @lucaskanashiro and @xnox for visibility, and in case they can provide any further info.

jocado commented 1 year ago

BTW - @wordjelly , if the Golang issue you're referring to is related to this, then a fix for that was already backported.

It should be in the snap channel latest/candidate if you want try or test that.

wordjelly commented 1 year ago

@jocado sorry, that throws the same error, I'm giving latest/edge a try. Will update on progress soon.

wordjelly commented 1 year ago

It works with latest/edge. For anyone hitting 'invalid host header' do this :

sudo snap remove docker --purge

sudo snap install docker --channel=latest/edge
jocado commented 1 year ago

Strange, perhaps I had the incorrect revision info. Glad that works for you at least, and thanks for confirming :+1:

lucaskanashiro commented 1 year ago

@wordjelly could you please share any error log from your attempts of using docker compose? How did you install docker compose? Are you using the command provided by the snap? I'd like to understand a bit better what is happening here.

And version 24.x should be pushed to the edge channel as soon as we promote the current beta to candidate and then stable. There is some internal testing going on right now.

wordjelly commented 1 year ago

@lucaskanashiro , thank you for the update, I've tried to include a reproducible setup for this problem below:

# Install docker from snap
sudo snap install docker
# add the user to the docker group(the usual stuff that needs to be done to avoid the permission issue with the docker socket).. I won't mention that here.

Create a dummy project with a docker-compose.yml that MUST Reference a Dockerfile in the build step. Kindly note that the problem emerges only when defining services that use a Dockerfile in the build step:

# Create a new directory as a test case.
mkdir debug_docker_snap_issue
cd debug_docker_snap_issue
pico docker-compose.yml

Contents of docker-compose.yml

version: '3'
services:
  nodejs_test:
    network_mode: "host"
    build:
      dockerfile: Dockerfile
    ports:
      - "8080:8080"
    volumes:
      - .:/home/node/app

Contents of Dockerfile

FROM ubuntu:22.04

RUN mkdir -p /home/node/app/node_modules

WORKDIR /home/node/app

RUN apt-get update && apt-get install -y python3 build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev nodejs npm

Then run

docker compose up nodejs_test

The build will fail with "http: invalid host header".

Kindly note that, this issue seems to have cropped up for a lot of people in the last 48 hours. I have no clue how docker works, but it seems, it internally updated its golang version yesterday. I had a perfectly working setup with the same snap, just 72 hours ago. Here is a link from stackoverflow to another person who seems to have the same problem (not using snap though) : Docker Nodejs fails with invalid http host header

RawToast commented 1 year ago

@lucaskanashiro if it helps, I have the same issue and checked this PR/repository after reading up on this issue in another issue, it seems there are fixes in later versions that are missing for compose to function with golang > 1.20:

https://github.com/moby/moby/issues/46614#issuecomment-1757751921

locnnil commented 4 weeks ago

As the current version of the snap in stable is 24.0.5 and the upcoming version in beta is 27.2.0, may I consider this close?

alexhaydock commented 1 week ago

As the current version of the snap in stable is 24.0.5 and the upcoming version in beta is 27.2.0, may I consider this close?

I don't think so. Although the original ticket was opened to point out the lack of Docker 24.x, the original question of 'Why is this version so old?' is still relevant today.

Based on the upstream support matrix for Docker Engine (aka Moby), there is no upstream support for Docker 24.x anymore.

I'm not 100% sure where the specific date has been sourced, but endoflife.date lists 24.x as unsupported as of June 2024.

Is there a particular reason why the stable branch for the Snap is so far behind?