Permalink
Browse files

dgoss: Fix cp strategy for existing /goss folder (#399)

When using dgoss with the 'cp' strategy and a container image which
already contains the '/goss' directory, the `docker cp` command copies
the local goss folder to '/goss/goss' instead of copying the contents
into '/goss'.

As preserving existing directory contents within the container can be
interesting (e.g. generating goss vars during build time), this commit
fixes dgoss to use `docker cp srcdir/. destdir` instead of `docker cp
srcdir destdir` - note the difference of the trailing slash and dot.

The exact behavior of the Docker cp command can be found at:
https://docs.docker.com/engine/reference/commandline/cp/#extended-description

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
  • Loading branch information...
ppmathis authored and aelsabbahy committed Dec 28, 2018
1 parent ff20e1f commit 73a2eafb64c327014f40da54302fbcc8c413da5b
Showing with 1 addition and 1 deletion.
  1. +1 −1 extras/dgoss/dgoss
@@ -43,7 +43,7 @@ run(){
info "Creating docker container"
id=$(docker create "${@:2}")
info "Copy goss files into container"
docker cp $tmp_dir $id:/goss
docker cp $tmp_dir/. $id:/goss
info "Starting docker container"
docker start $id > /dev/null
;;

0 comments on commit 73a2eaf

Please sign in to comment.