Search This Blog

Monday, 6 August 2018

Docker issue with "no such file or directory"

Problem


Trying run a docker container fails with mysterious error:
container_linux.go:247: starting container process caused "exec: \"./twit_test\": stat ./twit_test: no such file or directory"
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"./twit_test\": stat ./twit_test: no such file or directory".
ERRO[0000] error getting events from daemon: context canceled
Makefile:18: recipe for target 'run' failed
make: *** [run] Error 127
Container could not be started on a remote server while on local machine all worked fine.

Background


Command:

docker run \
--name=twit-test \
--rm \
-p 5000:7077 \
-v /home/tamara/data:/app \
        -e TWITTER_CONS_KEY=${TWITTER_CONS_KEY} \
-e TWITTER_CONS_SECRET=${TWITTER_CONS_SECRET} \
quay.io/tamarakaufler/twit-test:v1alpha1


Dockerfile is located in ~/programming/go/src/..../go-twit/examples

After some testing and poking around, I located the offending line, which was the volume binding. From what I can see the local volume to be bindmounted (a funny word) must be on the level where the command is run or lower, ie the same directory or its subdirectory. Maybe this is a well known fact but it was not to me. Wiser now.

Wednesday, 1 August 2018

Eclectic collection of helpful Docker and Kubernetes commands

Docker


docker build -f gcd-service/Dockerfile -t quay.io/tamarakaufler/gcd-service:$(GCD_IMAGE_TAG) .

docker login quay.io -u tamarakaufler -p $QUAY_PASS

docker push quay.io/tamarakaufler/gcd-service:$GCD_IMAGE_TAG

docker ps | grep "postgres" | awk '{print $1}' | xargs docker stop

docker ps | grep "-service" | awk '{print $1}' | xargs docker rm -f

docker run --name=decrypt-incremental --rm -v $PWD:/data quay.io/tamarakaufler/decrypt-incremental:v1alpha1 -f=/data/test4.txt

kubectl logs --namespace=kube-system $(kubectl get pods --namespace=kube-system -l k8s-app=kube-dns -o name) -c sidecar


Kubernetes


kubectl delete pods $(kubectl get pods |grep 'fe-deployment'|awk '{print $1;}')

kubectl port-forward $(kubectl get  pods --selector=app=kube-prometheus-grafana -n  monitoring --output=jsonpath="{.items..metadata.name}") -n monitoring  3000

kubectl get nodes -o json | grep name