genuinetools / img

Standalone, daemon-less, unprivileged Dockerfile and OCI compatible container image builder.
https://blog.jessfraz.com/post/building-container-images-securely-on-kubernetes/
MIT License
3.9k stars 231 forks source link

RUN command from the dockerfile hangs #281

Open anikulkarni opened 4 years ago

anikulkarni commented 4 years ago

I am trying to use img tool and whenever I put RUN command in the Dockerfile, it just hangs. I am new to this, so it might be some silly mistake on my side, so please bear with me. Here's the output:

/home/rwi1/vendor/k8s/img/bin/x64/img-0.5.7 build --no-cache --platform=linux/amd64 -t rackware-trai:vhercules-sprint2.0.0.4 -d /home/rwi1/apps/swift-traipod//.staging DEBU[0000] using backend: native Building docker.io/library/rackware-trai:vhercules-sprint2.0.0.4 Setting up the rootfs... this may take a bit. DEBU[0000] serving grpc connection [+] Building 0.0s (0/2) => [internal] load build definition from Dockerfile 0.0s [+] Building 0.1s (0/2) => [internal] load build definition from Dockerfile 0.1s [+] Building 0.2s (0/2) [+] Building 0.3s (0/2) [+] Building 0.6s (2/2) => [internal] load build definition from Dockerfile 0.6s => => transferring dockerfile: 364B 0.0s => [internal] load .dockerignore 0.4s [+] Building 0.9s (2/3) => [internal] load build definition from Dockerfile 0.6s => => transferring dockerfile: 364B 0.0sd => [internal] load .dockerignore 0.4sr => => transferring context: 2B 0.0s [+] Building 1.2s (2/3) => [internal] load build definition from Dockerfile 0.6so => => transferring dockerfile: 364B 0.0sT[+] Building 1.3s (2/3) => [internal] load build definition from Dockerfile 0.6sb => => transferring dockerfile: 364B 0.0s => [internal] load .dockerignore 0.4sd => => transferring context: 2B 0.0sr => [internal] load metadata for docker.io/library/centos:8 0.7s DEBU[0002] fetch response received response.headers="map[Content-Type:[application/vnd.docker.distribution.manifest.list.v2+json] Docker-Conte[+] Building 1.6s (2/3) => [internal] load build definition from Dockerfile 0.6s2[+] Building 1.7s (2/3) => [internal] load build definition from Dockerfile 0.6s [+] Building 1.8s (2/3) => [internal] load build definition from Dockerfile 0.6s [+] Building 3.8s (4/5) [+] Building 835.8s (4/5) => [internal] load build definition from Dockerfile 0.6s. => => transferring dockerfile: 364B 0.0s => [internal] load .dockerignore 0.4se => => transferring context: 2B 0.0s => [internal] load metadata for docker.io/library/centos:8 1.2s => CACHED [1/2] FROM docker.io/library/centos:8@sha256:fe8d824220415eed5477b63addf40fb06c3b049404242b31982106ac204f6700 0.0s => => resolve docker.io/library/centos:8@sha256:fe8d824220415eed5477b63addf40fb06c3b049404242b31982106ac204f6700 0.0s => [2/2] RUN /bin/bash -c echo

It just sits there forever. I tried to play with multiple commands, but it doesn't work. The same is the behavior seen with other commands like COPY too. I am using embedded 'runc' here and host is non-container Centos6.

[root@akulk-cdev01 swift-traipod]# cat /etc/redhat-release CentOS release 6.10 (Final)

[root@akulk-cdev01 swift-traipod]# uname -a Linux akulk-cdev01.dev 2.6.32-754.12.1.el6.x86_64 #1 SMP Tue Apr 9 14:52:26 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

[root@akulk-cdev01 swift-traipod]# ps -ef | grep img root 24404 24392 0 04:57 pts/6 00:00:06 /home/rwi1/vendor/k8s/img/bin/x64/img-0.5.7 build --no-cache --platform=linux/amd64 -t rackware-trai:vhercules-sprint2.0.0.4 -d /home/rwi1/apps/swift-traipod//.staging root 24434 24404 0 04:57 pts/6 00:00:00 runc --log /root/.local/share/img/runc/native/executor/runc-log.json --log-format json run --bundle /root/.local/share/img/runc/native/executor/xs1olmxcgu5mizmzpoi3n9kn7 xs1olmxcgu5mizmzpoi3n9kn7 root 24506 8229 0 05:10 pts/5 00:00:00 grep img

[root@akulk-cdev01 swift-traipod]# tail -n 20 /root/.local/share/img/runc/native/executor/runc-log.json {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:10-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:10-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:10-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:10-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:10-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:10-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:10-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:10-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:10-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:10-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:10-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:10-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:11-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:11-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:11-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:11-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:11-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:11-06:00"} {"level":"error","msg":"container \"vir6wu1qffc0ot69u69m65ma4\" does not exist\n","time":"2020-03-13T04:51:11-06:00"} {"level":"warning","msg":"invalid argument","time":"2020-03-13T04:57:57-06:00"}

Dockerfile: [root@akulk-cdev01 swift-traipod]# cat Dockerfile FROM centos:8

ENV STAGING . ENV INSTALL_ROOT /opt/bin

RUN /bin/bash -c echo

RUN yum install -y rsync libmicrohttpd-devel libmicrohttpd

RUN '/bin/sh -c mkdir -p ${INSTALL_ROOT}'

COPY ${STAGING}/bin/* ${INSTALL_ROOT}/

WORKDIR ${INSTALL_ROOT} ENTRYPOINT ${INSTALL_ROOT}/swift-agent

EXPOSE 443

Img version is 0.5.7 (one downloaded from the github releases page). I also tried to copy newuidmap/gidmap utilities to /bin, though I believe it is only for debian distros(?). Any pointers?

kekoav commented 4 years ago

What version of runc are you using? What does img version detect?