You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/03/01 06:06:46 UTC

[GitHub] chetanmeh opened a new pull request #3374: Use Docker ADD command to untar

chetanmeh opened a new pull request #3374: Use Docker ADD command to untar
URL: https://github.com/apache/incubator-openwhisk/pull/3374
 
 
   This PR has two changes
   
   ### Use ADD instead of COPY
   
   Currently 
   * controller - The tar file is copied but not removed thus increasing the size
   * invoker - Copies the tar and then removes it after untarring it
   
   Instead of doing this use ADD command which has an implicit support for untar. See [ADD vs COPY][1]
   
   > Consequently, the best use for ADD is local tar file auto-extraction into the image, as in ADD rootfs.tar.xz /.
   
   With this change size of controller images drops to 281MB from 361MB (~80MB reduction)
   
   ### Change in CMD
   
   ```diff
   -CMD ["init.sh", "0"]
   +CMD ["./init.sh", "0"]
   ``` 
   
   When I am extending the controller image for building a custom image for embedding custom ArtifactStore
   
   ```
   FROM whisk/controller
   
   COPY build/docker /controller/
   ```
   
   The startup failed with
   ```
   docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"init.sh\": executable file not found in $PATH".
   ```
   
   On checking the `env` it appears `PATH` does not contain root directory
   ```
   $ docker run -it --entrypoint /bin/bash whisk/controller
   bash-4.3# env
   ...
   PATH=/usr/lib/jvm/java-8-oracle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
   BUILD=15
   PWD=/
   ...```
   
   Changing the command to use explicit relative path as in `./init.sh` fixed the issue
   
   [1]: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-or-copy
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services