running a container based on buildah image on docker host
Hi, I build an image with Buildah and I can run a container with Podman based on this image without any problems. Now I need to run a container based on this image with Docker and it fails. I get this error: /usr/bin/docker-current: Error response from daemon: oci runtime error: container_linux.go:235: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory". Are there some incompatibility with Docker or do I need to add something when I build my image to get this image running on a docker host? Bellow you can find the script I used to build my image: #!/bin/bash # start new container from scratch newcontainer=$(buildah from scratch) scratchmnt=$(buildah mount ${newcontainer}) # install the packages yum install --nogpgcheck --installroot ${scratchmnt} rpm bash coreutils ansible shadow-utils --releasever 7 --setopt=tsflags=nodocs --setopt=override_install_langs=en_US.utf8 -y # Clean up yum cache if [ -d "${scratchmnt}" ]; then rm -rf "${scratchmnt}"/var/cache/yum fi #create user and group buildah run ${newcontainer} groupadd -g 10000 somegroup buildah run ${newcontainer} useradd -u 10200 -g somegroup someuser # configure container label, entrypoint, default user and default working directory buildah config --label name=el7-ansible ${newcontainer} buildah config --cmd /bin/bash ${newcontainer} buildah config --user someuser ${newcontainer} buildah config --workingdir /etc/ansible ${newcontainer} # commit the image buildah unmount ${newcontainer} buildah commit ${newcontainer} el7-ansible #some cleanup buildah rm ${newcontainer}
Have you tried running the container image with podman to verify it's not an actual problem in the image? I "believe" somehow bash never getting installed and that's the actual cause of the failure... On Fri, Jul 26, 2019 at 4:47 AM <svinz82@gmail.com> wrote:
Hi,
I build an image with Buildah and I can run a container with Podman based on this image without any problems.
Now I need to run a container based on this image with Docker and it fails.
I get this error:
/usr/bin/docker-current: Error response from daemon: oci runtime error: container_linux.go:235: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory".
Are there some incompatibility with Docker or do I need to add something when I build my image to get this image running on a docker host?
Bellow you can find the script I used to build my image:
#!/bin/bash
# start new container from scratch newcontainer=$(buildah from scratch) scratchmnt=$(buildah mount ${newcontainer})
# install the packages yum install --nogpgcheck --installroot ${scratchmnt} rpm bash coreutils ansible shadow-utils --releasever 7 --setopt=tsflags=nodocs --setopt=override_install_langs=en_US.utf8 -y
# Clean up yum cache if [ -d "${scratchmnt}" ]; then rm -rf "${scratchmnt}"/var/cache/yum fi
#create user and group buildah run ${newcontainer} groupadd -g 10000 somegroup buildah run ${newcontainer} useradd -u 10200 -g somegroup someuser
# configure container label, entrypoint, default user and default working directory buildah config --label name=el7-ansible ${newcontainer} buildah config --cmd /bin/bash ${newcontainer} buildah config --user someuser ${newcontainer} buildah config --workingdir /etc/ansible ${newcontainer}
# commit the image buildah unmount ${newcontainer} buildah commit ${newcontainer} el7-ansible
#some cleanup buildah rm ${newcontainer}
_______________________________________________ Buildah mailing list -- buildah@lists.buildah.io To unsubscribe send an email to buildah-leave@lists.buildah.io
-- -- Scott McCarty, RHCA Product Management - Containers, Red Hat Enterprise Linux & OpenShift Email: smccarty@redhat.com Phone: 312-660-3535 Cell: 330-807-1043 Web: http://crunchtools.com Have questions on Red Hat UBI? Check out the official FAQ: https://red.ht/2yaUcez
On Fri, Jul 26, 2019 at 08:41:31AM -0000, svinz82@gmail.com wrote:
Hi,
I build an image with Buildah and I can run a container with Podman based on this image without any problems.
Now I need to run a container based on this image with Docker and it fails.
I get this error:
/usr/bin/docker-current: Error response from daemon: oci runtime error: container_linux.go:235: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory".
Are there some incompatibility with Docker or do I need to add something when I build my image to get this image running on a docker host?
Bellow you can find the script I used to build my image: [snip]
Hmm, (docker run --rm -it testimage) worked for me I tried it on a CentOS 7 box using buildah-1.8.2-2.gite23314b.el7.centos to build and docker-1.13.1-96.gitb2f74b2.el7.centos to run. Like Scott suggested, something might have caused the installation of the bash package to fail. In cases like that, yum can still exit with status 0, which is why you'd see things like OpenShift dockerfiles running "rpm -V" right after "yum" to make sure that all of the packages that yum was told to install were actually installed [1]. HTH, Nalin [1] https://github.com/openshift/origin/blob/release-3.11/images/base/Dockerfile...
Hi, Thanks for you answers. All my test where done on a Centos 7 box and I successfully started a container with podman based on this image. So I'm sure bash was successfully installed and running. I forgot to mention that I also tested with the '--format docker' as suggested by Tow Sweeney without any success. How can I check with buildah if the image has been build with the docker image-spec instead of the OCI? Regards,
The way that I use is: buildah inspect --format '{{.Manifest}}' myimagenameorid In the json that's printed out, the mediaType field will list something like this for OCI: application/vnd.oci.image.config.v1+json or this for Docker: application/vnd.docker.distribution.manifest.v2+json They may vary, but looking for oci or docker within will get it. Just thinking, we might have an opportunity though to add an option to inspect to list the type a bit more clearly.... t On 07/28/2019 05:02 AM, svinz82@gmail.com wrote:
Hi,
Thanks for you answers.
All my test where done on a Centos 7 box and I successfully started a container with podman based on this image.
So I'm sure bash was successfully installed and running.
I forgot to mention that I also tested with the '--format docker' as suggested by Tow Sweeney without any success.
How can I check with buildah if the image has been build with the docker image-spec instead of the OCI?
Regards,
_______________________________________________ Buildah mailing list -- buildah@lists.buildah.io To unsubscribe send an email to buildah-leave@lists.buildah.io
participants (4)
-
Nalin Dahyabhai -
Scott McCarty -
svinz82@gmail.com -
Tom Sweeney