-
Notifications
You must be signed in to change notification settings - Fork 417
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 either as alias to Docker or natively #3170
Comments
Hi @DerGut !
It's definitely possible :) there are no blockers for Copilot to use Podman. I've added the feature request label to the issue, thank you! |
I wonder if Podman is the best target or if something like Colima or Rancher Desktop would be a better direction. My team also uses AWS SAM and there are efforts to enable Lima based container engines (Colima / Rancher Desktop). It seems unusual to use two AWS toolchains and need to have two separate container engines for each toolchain. My organization looked at Podman and the lack of bind mount functionality on Mac and Windows is a blocker for us. That definitely blocks SAM local invocation as the SAM container bind mounts the source code. We don't predict that we'll be using volumes/EFS in Copilot/ECS; but for organizations that would, they would be blocked. |
yes offer podman as option would be great, tried the command alias but didn't work. |
Hey all, I have done a deep investigation into Podman + AWS Copilot. I was able to get Copilot to use Podman by adding a symlink: Unfortunately there is a difference between how Podman does image digests and how Docker Desktop does image digests, which blocks the use of Podman at this time. I've created an issue on the Podman repo: containers/podman#14779 We will need to investigate deeper workarounds to how we handle image digests, or hope for a patch to Podman which causes Podman to generate consistent image digests. |
A little more digging here, the nasty hack below works when using podman. I'm happy to help work on an a useful PR for this, though not sure how best to fit it in to the existing project. +++ b/internal/pkg/docker/dockerengine/dockerengine.go
@@ -151,6 +151,9 @@ func (c CmdClient) Push(uri string, tags ...string) (digest string, err error) {
images = append(images, imageName(uri, tag))
}
var args []string
+ digestFile, _ := os.CreateTemp("", "copilot")
+ defer os.Remove(digestFile.Name())
+ args = append(args, "--digestfile", digestFile.Name())
if ci, _ := c.lookupEnv("CI"); ci == "true" {
args = append(args, "--quiet")
}
@@ -160,16 +163,9 @@ func (c CmdClient) Push(uri string, tags ...string) (digest string, err error) {
return "", fmt.Errorf("docker push %s: %w", img, err)
}
}
- buf := new(strings.Builder)
- if err := c.runner.Run("docker", []string{"inspect", "--format", "'{{json (index .RepoDigests 0)}}'", uri}, exec.Stdout(buf)); err != nil {
- return "", fmt.Errorf("inspect image digest for %s: %w", uri, err)
- }
- repoDigest := strings.Trim(strings.TrimSpace(buf.String()), `"'`) // remove new lines and quotes from output
- parts := strings.SplitAfter(repoDigest, "@")
- if len(parts) != 2 {
- return "", fmt.Errorf("parse the digest from the repo digest '%s'", repoDigest)
- }
- return parts[1], nil
+ repoDigest, _ := os.ReadFile("./digest")
+ part := strings.TrimPrefix(string(repoDigest), "sha256:")
+ return part, nil
}
|
@MartinLeedotOrg Yay thank you for volunteering ❤️! It'd be helpful to discuss the design, perhaps as well as implementation plan before working on the PR - this would save both you and us a lot of back and forth. Here is an example of a discussion that we had with a contributor before. With this integration, we'd want to keep the experience of building with If this sounds good to you, I can kick off a discussion: what would the experience for a user that builds with Podman be like with your proposed snippet? The code snippet seems to be dealing with the image digest. Would users need to first @efekarakus also raised several questions here previously. The second question is answered (i.e. just Thank you again ❤️ |
I haven't seen a consistent approach here... I like the idea of specifying the build engine in the manifest though. Another approach could simply be running
That's a very common approach. It would make the approach above of parsing the output from docker version simpler too.
I'd say yes. There's many ways to make OCI images, we shouldn't care which the user opts for and should just make an image happen using the tools available in their environment. |
Sorry for the naive question @MartinLeedotOrg, how can we tell if |
It would be great if Podman could be used in addition to Docker for building images.
I had to install Docker to be able to use Copilot. But I don't think this has to be necessary as most of the Docker commands can be replaced by running
podman
in place ofdocker
(as far as I know).I realise, that it might be easier to accept a docker alias from the shell environment than it is to implement a new client like in dockerengine.go.
Under
e2e
there already seems to be an implementation that makes use of the bash shell context by runningbash -c docker ...
:copilot-cli/e2e/internal/client/docker.go
Lines 54 to 56 in f1b8e46
Would this be a possible future addition or is there any technical limitation preventing Podman from being used here?
The text was updated successfully, but these errors were encountered: