Skip to content

Commit

Permalink
Fix attachment flow when running dock with active project container
Browse files Browse the repository at this point in the history
This changes fixes a bug in the container attachment logic, resulting
from a missed env var expansion, which prevents users from reattaching to
Dock containers when executing `dock` in a project repo with the
associated Dock container already up and running. The bug was introduced
in change:
01e5fd9#diff-79d7079a017e90205ccbbe385c9ce6a8R805

Also, while at it, updated the attachment logic to allow users to specify
additional command line args to be executed immediately following Dock
container attachment.

e.g.:
-----
- running `dock bash` and choosing to attach to a container results in the
  creation of and entry to a bash shell rather than the default 'sh'
  shell
- running `dock ls` and choosing to attach to a container results in the
  listing of the current working directory upon entry followed by exiting
  of the container
  • Loading branch information
0xOI committed Mar 22, 2018
1 parent a9789a6 commit 09a2599
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bin/dock
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ check_for_existing_container() {
if interactive; then
ask "Attach to the container? (y/n)" n answer
if [ "${answer}" = "y" ]; then
attach_to_container "target_container"
attach_to_container "$target_container"
else
info "You answered '${answer}' instead of 'y'; not attaching."
fi
Expand Down Expand Up @@ -1153,6 +1153,7 @@ if [ $# -ge $OPTIND ]; then
# Set command to remaining unparsed arguments
# (overrides anything that was defined in $dock_file)
command_args=("${@:$OPTIND}")
attach_command "${@:$OPTIND}"
fi

# If we're already inside a Dock environment, just execute the command.
Expand Down

0 comments on commit 09a2599

Please sign in to comment.