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.89k stars 230 forks source link

Ordering of command line switches #220

Closed oxr463 closed 5 years ago

oxr463 commented 5 years ago

The commands/UX are the same as docker {build,tag,push,pull,login,logout,save} so all you have to do is replace docker with img in your scripts, command line, and/or life. --README.md

For the build command, I have scripts that run docker build . -t {{tag}}, however, this doesn't work with img.

Test files:

ls
Dockerfile  img-linux-amd64

Running img build -t {{tag}} . works fine,

./img-linux-amd64 build -t test/image .
Building docker.io/test/image:latest
Setting up the rootfs... this may take a bit.
[+] Building 66.7s (7/7) FINISHED                                                                                                                                                                                                             => [internal] load build definition from Dockerfile                                                                                                                                                                                    0.1s
 => => transferring dockerfile: 222B                                                                                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                       0.1s
 => => transferring context: 2B                                                                                                                                                                                                         0.0s
 => [internal] load metadata for docker.io/library/debian:9.7                                                                                                                                                                           1.9s
 => [1/3] FROM docker.io/library/debian:9.7@sha256:066051f6674f6a3293bbd5a190081b1ae7fcae655a3884db59ebb3a2831da623                                                                                                                    21.7s
 => => resolve docker.io/library/debian:9.7@sha256:066051f6674f6a3293bbd5a190081b1ae7fcae655a3884db59ebb3a2831da623                                                                                                                     0.0s
 => => sha256:066051f6674f6a3293bbd5a190081b1ae7fcae655a3884db59ebb3a2831da623 2.36kB / 2.36kB                                                                                                                                          0.0s
 => => sha256:92cfa9da19ed9dd7683efbf25a5e2e3a15256dd88f224d0a1f907bfa1fb12ad1 529B / 529B                                                                                                                                              0.0s
 => => sha256:741437d97401b83849ccbfe4ed8964049b752081647d7f1ea8aea29d989f8968 45.34MB / 45.34MB                                                                                                                                       19.2s
 => => sha256:d508d16c64cd269a838aca07b4823d6271963e7f60c2ecaebe62b7f33d1f0842 1.50kB / 1.50kB                                                                                                                                          0.0s
 => => unpacking docker.io/library/debian:9.7@sha256:066051f6674f6a3293bbd5a190081b1ae7fcae655a3884db59ebb3a2831da623                                                                                                                   2.5s
 => [2/3] RUN apt update && apt upgrade -y &&     apt install -y easy-rsa openvpn                                                                                                                                                      38.6s
 => [3/3] RUN make-cadir easy-rsa/ &&     ln -s openssl-1.0.0.cnf openssl.cnf                                                                                                                                                           0.3s
 => exporting to image                                                                                                                                                                                                                  4.0s
 => => exporting layers                                                                                                                                                                                                                 3.9s
 => => exporting manifest sha256:e0b8fce6f6627e3a762dda60f5372960db43e142a3fa202f86673f7eeca436d9                                                                                                                                       0.0s
 => => exporting config sha256:8e4a62d2cbd0d082917aae6c4277050208501df6f5ebaeabf2f723d1e97419d0                                                                                                                                         0.0s
 => => naming to docker.io/test/image:latest                                                                                                                                                                                            0.0s
Successfully built docker.io/test/image:latest

However, img . -t {{tag}} fails,

./img-linux-amd64 build . -t test/image
please specify an image tag with `-t`

And in docker,

docker build . -t test/image
Sending build context to Docker daemon   25.7MB
Step 1/4 : FROM debian:9.7
 ---> d508d16c64cd
Step 2/4 : RUN apt update && apt upgrade -y &&     apt install -y easy-rsa openvpn
 ---> Using cache
 ---> bea2ed94991e
Step 3/4 : WORKDIR /etc/openvpn
 ---> Using cache
 ---> 676b704bb4d1
Step 4/4 : RUN make-cadir easy-rsa/ &&     ln -s openssl-1.0.0.cnf openssl.cnf
 ---> Using cache
 ---> 14e32b65fb9f
Successfully built 14e32b65fb9f
Successfully tagged test/image:latest
ehotinger commented 5 years ago

Same as https://github.com/genuinetools/img/issues/149

oxr463 commented 5 years ago

I didn't see that one, apologies.