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

Question: how to use img in docker ? #336

Open
warmanton opened this issue Apr 8, 2021 · 1 comment
Open

Question: how to use img in docker ? #336

warmanton opened this issue Apr 8, 2021 · 1 comment

Comments

@warmanton
Copy link

Since Arch linux has no newuidmap and seccomp binaries (I did not found yet) I tried to use docker image of img. Used example from documentation

docker run -it --name img --volume $(pwd):/home/user/src:ro --workdir /home/user/src --volume "${HOME}/.docker:/root/.docker:ro" --security-opt seccomp=unconfined --security-opt apparmor=unconfined r.j3ss.co/img build -t test -f docker/myapp.Dockerfile .

It works but where then to find the image ? Container removed just after it finished to build the image. May be not enough examples in documentation. How to get image after building ? :-).

@austonpramodh
Copy link

austonpramodh commented Apr 27, 2021

Hi @warmanton,
I am not sure if this is the right way to do it. You can build an image and output it to a tar file. Then you can use crane to push the tar file.

Build image and output it to tar file.
docker run -it --name img --volume $(pwd):/home/user/src --workdir /home/user/src --security-opt seccomp=unconfined --security-opt apparmor=unconfined r.j3ss.co/img build -t test -o type=tar,dest=image.tar -f docker/myapp.Dockerfile .

Push the image to a registry
docker run --rm --volume "$(pwd):/app" --entrypoint="sh" gcr.io/go-containerregistry/crane:debug sh -c "crane auth login -u $USERNAME -p $PASSWORD $REGISTRY && crane push /app/image.tar $REGISTRY/path/to/your/image:version"

I haven't tried it myself. Let me know if it works.

Reference: https://stackoverflow.com/questions/62665625/how-to-perform-kaniko-docker-build-and-push-in-separate-gitlab-ci-stages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants