collected wisdom after working with hive/docker (#669)

This commit is contained in:
Jordan Hrycaj 2021-05-18 16:38:35 +01:00 committed by GitHub
parent 18553156b1
commit 91e24e3581
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 81 additions and 0 deletions

View File

@ -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:<br>
_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:<br>
+ 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<br>
apt udate
apt install iproute2 procps vim openssh-client strace
* Resume hive installation & processing:<br>
In the nimbus container run
echo > /tmp/wait-for-stop

32
hive_integration/docker-shell Executable file
View File

@ -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