Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbochi committed Apr 3, 2017
1 parent 041c509 commit 9c80466
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
25 changes: 19 additions & 6 deletions circle.yml → .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: 2
executorType: docker
containerInfo:
- image: docker:1.10.0
stages:
build:
workDir: /home/circleci/drun
working_directory: /home/circleci/drun
machine: true
docker:
- image: docker:17.03.0
environment:
RM_OPT: "" # tells drun not to --rm since CircleCI doesn't like it
steps:
Expand All @@ -19,7 +19,20 @@ stages:
- type: setup-docker-engine
- type: shell
shell: /bin/sh
command: docker version
command: env
- type: shell
shell: /bin/sh
command: |
docker version
docker --help
docker info
docker --log-level debug ps
find /tmp/docker-*
mkdir -p /home/circleci/drun/.docker/
cp ${DOCKER_CERT_PATH}/*.pem /home/circleci/drun/.docker/
ls -lha /home/circleci/drun/.docker/
./drun -x alpine:3.5 ls -lha /home/circleci/drun/
./drun -x alpine:3.5 ls -lha /home/circleci/drun/.docker/
- type: shell
shell: /bin/sh
command: ./drun -x alpine:3.5 date
Expand All @@ -28,7 +41,7 @@ stages:
command: ./drun -x alpine:3.5 cat /etc/issue | grep 'Alpine Linux 3.5' # should execute command inside container
- type: shell
shell: /bin/sh
command: ./drun -x docker:1.10.0 docker version # should bind docker.sock
command: ./drun -x docker:17.03.0 docker version # should bind docker.sock
- type: shell
shell: /bin/sh
command: ./drun -x docker:1.10.0 sh -c './drun -x docker:1.10.0 true' # should do inception in 2 levels
Expand Down
10 changes: 8 additions & 2 deletions drun
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ if [ -n "${ENV_REGEX:-}" ]; then
ENV_FILE_OPT="--env-file=$ENV_FILE"
fi

MAP_CURRENT_DIR_OPT="-v $CURRENT_DIR:$CONTAINER_HOME"
MAP_CURRENT_DIR_OPT="-v $CURRENT_DIR/:$CONTAINER_HOME/"
# Inception detection
if [ -f '/proc/1/cgroup' ]; then
cat /proc/1/cgroup
CURRENT_CONTAINER=$(grep '/docker/' -- /proc/1/cgroup | head -n1 | cut -d '/' -f 3)
if [ -n "${CURRENT_CONTAINER}" ] && docker inspect --format='ok' "${CURRENT_CONTAINER}" 2>&1 > /dev/null; then
# Maps volumes from current container
Expand All @@ -135,8 +136,13 @@ if [ "${MOUNTDOCKERSOCK:-}" != 'n' -a -r "$DSOCK" -a -w "$DSOCK" -a -S "$DSOCK"
EXTRA_OPTS="${EXTRA_OPTS:-} -v ${DSOCK}:${DSOCK}"
fi
elif [ -n "${DOCKER_HOST}" ]; then
# ARRRGH=$(echo $DOCKER_HOST | sed 's/tcp:/https:/')
# echo curl -ik "$ARRRGH"/_ping
# curl -ik "$ARRRGH"/_ping
# echo '--------'
EXTRA_OPTS="${EXTRA_OPTS:-} -e DOCKER_HOST=${DOCKER_HOST}"
EXTRA_OPTS="${EXTRA_OPTS:-} -e DOCKER_TLS_VERIFY=0"
EXTRA_OPTS="${EXTRA_OPTS:-} -e DOCKER_TLS_VERIFY=1"
# EXTRA_OPTS="${EXTRA_OPTS:-} -e DOCKER_CERT_PATH=${DOCKER_CERT_PATH} -v ${DOCKER_CERT_PATH}/:${DOCKER_CERT_PATH}/:ro"
fi

RM_OPT=${RM_OPT=--rm}
Expand Down

0 comments on commit 9c80466

Please sign in to comment.