From 91e24e35818ccf05618c0c3e5a57033672777c01 Mon Sep 17 00:00:00 2001 From: Jordan Hrycaj Date: Tue, 18 May 2021 16:38:35 +0100 Subject: [PATCH] collected wisdom after working with hive/docker (#669) --- hive_integration/README.md | 49 +++++++++++++++++++++++++++++++++++ hive_integration/docker-shell | 32 +++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100755 hive_integration/docker-shell diff --git a/hive_integration/README.md b/hive_integration/README.md index e77770c62..37a8e0134 100644 --- a/hive_integration/README.md +++ b/hive_integration/README.md @@ -128,3 +128,52 @@ in a markdown file with the same name with the simulator. ```nim nim c -r -d:release hive_integration/nodocker/graphql/graphql_sim ``` +## Observations when working with hive/docker + +### DNS problems with hive simulation container running alpine OS + +* Problem:
+ _hive_ bails out with error when compiling docker compile because + it cannot resolve some domain name like _github.com_. It occured with + a locally running DNS resolver (as opposed to a proxy type resolver.) + +* Solution:
+ + First solution (may be undesirable): + Change local nameserver entry in /etc/resolv.conf to something like + + nameserver 8.8.8.8 + + Note that docker always copies the host's /etc/resolv.conf to the + container one before it executes a _RUN_ directive. + + + Second solution (tedious): + In the _Dockerfile_, prefix all affected _RUN_ directives with the text: + + echo nameserver 8.8.8.8 > /etc/resolv.conf; + +### Peek into nimbus container before it finalises + +* In the nimbus _Dockerfile_ before _ENTRYPOINT_, add the directive + + RUN mknod /tmp/wait-for-stop p;cat /tmp/wait-for-stop + +* (Re-)Build the container with the command: + + ./hive --docker.output ... + +* When the building process hangs at the + + RUN mknod ... + + directive, then use the _./docker-shell_ script to enter the running top + docker container + +* Useful commands after entering the nimbus container
+ + apt udate + apt install iproute2 procps vim openssh-client strace + +* Resume hive installation & processing:
+ In the nimbus container run + + echo > /tmp/wait-for-stop diff --git a/hive_integration/docker-shell b/hive_integration/docker-shell new file mode 100755 index 000000000..cc602efb1 --- /dev/null +++ b/hive_integration/docker-shell @@ -0,0 +1,32 @@ +#! /bin/sh + +self=`basename $0` + +ARGS="$*" +unset RUN CONTAINER + +set_container_name () { + CONTAINER=`docker ps -l | awk 'NR > 1 {print $NF;exit}'` + [ -n "$CONTAINER" ] || { + echo "*** $self: no container avilable (maybe try later)" >&2 + exit 1 + } +} + +case "$ARGS" in +-*) echo "Usage: $self [/shell|image_name ..]" >&2 + exit 2 + ;; +'') set_container_name + ARGS="$CONTAINER" + RUN=/bin/bash + ;; +/*) set_container_name + ARGS="$CONTAINER" + RUN="$*" +esac + +set -x +exec docker container exec -it $ARGS $RUN + +# End