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

Support podman in codebuild_build.sh #679

Open
mbacchi opened this issue Oct 17, 2023 · 1 comment
Open

Support podman in codebuild_build.sh #679

mbacchi opened this issue Oct 17, 2023 · 1 comment

Comments

@mbacchi
Copy link

mbacchi commented Oct 17, 2023

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
-    docker_command+="-v /var/run/docker.sock:/var/run/docker.sock -e "
+    docker_command+="-v /run/user/1000/podman/podman.sock:/var/run/docker.sock -e "
 fi
 
 docker_command+="\"IMAGE_NAME=$image_name\" -e \
  1. When running the script now, I still get an error:
./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:https://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:https://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):

  • OS: Fedora Linux 37 (x86)
@baskervilski
Copy link

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

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

3 participants