aws / aws-codebuild-docker-images

Official AWS CodeBuild repository for managed Docker images http://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref.html
Other
1.11k stars 973 forks source link

Support podman in codebuild_build.sh #679

Open mbacchi opened 11 months ago

mbacchi commented 11 months ago

Describe the bug Podman is an alternative to the Docker container engine, and fully compatible. On Linux it can typically replace docker by aliasing the command such as alias docker=podman. But when using podman, the codebuild_build.sh script does not work out of the box, and in fact I cannot get it to run at all without docker installed.

To Reproduce Steps to reproduce the behavior:

  1. On Fedora Linux (37) Docker is not installed by default. Configure alias docker=podman in ~/.bashrc and spawn a new shell. Run codebuild_build.sh and you get many errors.
  2. Use this diff to try to make some minor changes to use podman:
    
    diff -u codebuild_build.sh codebuild_build_new.sh 
    --- codebuild_build.sh  2023-10-17 12:48:16.685661350 -0400
    +++ codebuild_build_new.sh  2023-10-17 12:48:43.511815689 -0400
    @@ -96,12 +96,12 @@
     exit 1
    fi

-docker_command="docker run -it " +docker_command="podman run -it " if isOSWindows then docker_command+="-v //var/run/docker.sock:/var/run/docker.sock -e " else

./codebuild_build.sh -i localhost/aws/codebuild/standard:6.0 -a /tmp/artifacts -s ./sourcedir/
Build Command:

podman run -it -v /run/user/1000/podman/podman.sock:/var/run/docker.sock -e "IMAGE_NAME=localhost/aws/codebuild/standard:6.0" -e "ARTIFACTS=/tmp/artifacts" -e "SOURCE=sourcedir" -e "INITIATOR=username" public.ecr.aws/codebuild/local-builds:latest

ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
  1. I've also tried setting DOCKER_HOST unsuccessfully.

Expected behavior Should be able to run the images needed for the local codebuild build process.

Platform (please complete the following information):

baskervilski commented 1 month ago

It would be really nice to have this implemented...