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

Docker 25 support #696

Open
bencwallace opened this issue Jan 22, 2024 · 13 comments
Open

Docker 25 support #696

bencwallace opened this issue Jan 22, 2024 · 13 comments

Comments

@bencwallace
Copy link

Would be great to have CodeBuild images with Docker 25, which was just released. As discussed here, this will make it easier to use BuildKit caching during build jobs.

@JohnPreston
Copy link
Contributor

This is also an issue as with 25, running local builds fails with an API issue right away.
The only solution is to downgrade/stick to 24.

@Aposhian
Copy link

It looks like public.ecr.aws/codebuild/local-builds:latest has v18.09.0 of the docker CLI installed, and docker-compose 1.23.2 installed.

However, if the docker compose file within the local agent is just updated to version 2.1, then it works.

Suggestion found here: docker/compose#5103 (comment)

@souhub
Copy link

souhub commented Mar 5, 2024

I'd be happy to support v25 as well.

I tried Docker Engine v25, but I got error message

ERROR: client version 1.22 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version

I reinstalled Docker Desktop v4.26.1. It worked.
v4.26.1 is the latest using Docker Engine v24.
https://docs.docker.com/desktop/release-notes/#4261

@dangeReis
Copy link

It looks like public.ecr.aws/codebuild/local-builds:latest has v18.09.0 of the docker CLI installed, and docker-compose 1.23.2 installed.

However, if the docker compose file within the local agent is just updated to version 2.1, then it works.

Suggestion found here: docker/compose#5103 (comment)

I'm a bit confused, where does the docker-compose file need to be updated?

@Aposhian
Copy link

Aposhian commented Mar 7, 2024

Inside the docker image, at /LocalBuild/agent-resources/docker-compose.yml, at the top of the file is:

version: '2'

If you change it to

version: '2.1'

then it doesn't complain anymore.

@dangeReis
Copy link

@Aposhian In this repository? I'm not seeing that folder.

@Aposhian
Copy link

Aposhian commented Mar 8, 2024

It isn't in this repository. It is in the public.ecr.aws/codebuild/local-builds docker image. I'm not sure where the source for that is though (I don't think it is public).

@dangeReis
Copy link

Now that there have been critical vulnerabilities detected in docker 4.26, as the workaround is no longer tenable.

@day4me
Copy link

day4me commented Mar 15, 2024

After updating the docker compose file within the local agent to version 2.1 the error ERROR: client version 1.22 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version disappeared.
But I still had problems running the agent. During the execution, it just stuck on Waiting for agent ping step.
To fix that, I had to upgrade the docker-compose binary.

I just built the new image using public.ecr.aws/codebuild/local-builds as a base.
Dockerfile:

FROM public.ecr.aws/codebuild/local-builds:latest

RUN sed -i "s/version: '2'/version: '2.1'/g" /LocalBuild/agent-resources/docker-compose.yml
RUN curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
RUN chmod +x /usr/local/bin/docker-compose

This is my workaround, for now, to not use the old Docker engine version.

@Aposhian
Copy link

During the execution, it just stuck on Waiting for agent ping step.

I ran into the same issue. I just presumed it wasn't docker related. But good to know.

@ghanavat
Copy link

ghanavat commented Mar 19, 2024

How can the version of docker compose be changed inside this docker image public.ecr.aws/codebuild/local-builds, when we don't have access to the source?

@LZY7977
Copy link
Contributor

LZY7977 commented Apr 11, 2024

@ghanavat

CodeBuild installs Docker and Docker Compose in the /usr/local/bin directory. You can manually update their versions by creating a Dockerfile that builds on top of the CodeBuild base images

Here is an example of Dockerfile:

FROM public.ecr.aws/codebuild/local-builds:latest AS layer1

WORKDIR /LocalBuild

RUN set -ex \
    && rm -rf /usr/local/bin/docker \
    && curl -fSL "https://download.docker.com/linux/static/stable/x86_64/docker-25.0.0.tgz" -o docker.tgz \
    && tar --extract --file docker.tgz --strip-components 1 --directory /usr/local/bin/ \
    && rm docker.tgz \
    && docker -v

FROM layer1 AS layer2

RUN set -ex \
    && rm -rf /usr/local/bin/docker-compose \
    && curl -L "https://github.com/docker/compose/releases/download/v2.26.0/docker-compose-linux-x86_64" > /usr/local/bin/docker-compose \
    && chmod +x /usr/local/bin/docker-compose \
    && docker-compose version

This Dockerfile first removes the existing Docker and Docker Compose binaries, then downloads and extracts the specified Docker version into /usr/local/bin. In the second stage, it updates Docker Compose to the specified version. Remember to verify the downloaded versions and adjust the Dockerfile accordingly.

@dangeReis
Copy link

@LZY7977 Thank you. Is there a reason this hasn't made it into the official image?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants