aws / aws/aws-codebuild-docker-images
Support podman in codebuild_build.sh
- Dominant language
- Dockerfile
- Stars
- 1.2k
- Forks
- 971
- Avg merge
- 2h 47m
- Merged PRs (30d)
- 1
Description
**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](https://github.com/aws/aws-codebuild-docker-images/blob/master/local_builds/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 \
```
3. 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://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.
```
4. 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)
Contributor guide
Assessment
This issue has not been assessed yet.