Amplify build machines cannot install docker or build docker images

0

I'm stuck right now trying to build a docker image using the Amplify deploy process. I know that Amplify uses Amazon Linux 2023, this is my amplify.yml

commands:
                # install Docker
                - 'sudo yum update -y'
                - 'sudo yum install -y docker'
                - 'sudo service docker start'
                - 'sudo usermod -a -G docker $(whoami)'
                - 'docker info'

but in the logs I'm getting

sudo: service: command not found

I then tried running dockerd manually but it gives

buildx: Docker Buildx (Docker Inc.)
Version: v0.0.0+unknown
Path: /usr/libexec/docker/cli-plugins/docker-buildx
Server:
2024-09-10T04:29:34.095Z [WARNING]: ERROR: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/info": dial unix /var/run/docker.sock: connect: permission denied
errors pretty printing info

Are these machines more locked down than a normal Amazon Linux 2023 machine? Is there a workaround?

Davis
asked a month ago41 views
1 Answer
1
Accepted Answer

Hello.

I found the following GitHub issue.
As of September 2024, I don't think it is possible to use Docker with Amplify builds, as far as I see the issues below.
By the way, I think the following issue is probably about Gen1.
https://github.com/aws-amplify/amplify-hosting/issues/2550

Regarding Gen2, this is a blog in Japanese, but it was introduced that as a result of testing, Docker commands could not be used.
https://zenn.dev/ncdc/articles/f959131cf5f4b5

profile picture
EXPERT
answered a month ago
profile picture
EXPERT
reviewed a month ago
  • Thank you for the sleuthing, I guess I'll have to move my Amplify builds to Github

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions