singularity-docker: executable file not found in $PATH - docker

I get an error message when running a docker using singularity, probably related to som path issues. Any ideas how to troubleshoot this further?
singularity exec -B /home/local/data:/src/data \
-B /home/local/data:/src/outdir docker://cibersortx/fractions:latest \
--username my_email#edu.no --token xxxxxxxxxxxxxxx --refsample LM22.txt \
--mixture data.frame.txt
error:
INFO: Using cached SIF image
FATAL: "--username": executable file not found in $PATH

Related

How to solve JFrog config read error when building docker image - [Error] open /root/.jfrog/jfrog-cli.conf: read-only file system

I'm building a docker image and getting the error:
=> ERROR [14/36] RUN --mount=type=secret,id=jfrog-cfg,target=/root/.jfrog/jfrog-cli.conf jfrog rt dl --flat artifact 0.7s
------
> [14/36] RUN --mount=type=secret,id=jfrog-cfg,target=/root/.jfrog/jfrog-cli.conf jfrog rt dl --flat artifact/artifact.tar.gz; set -eux; mkdir -p /usr/local/artifact; tar xzf artifact.tar.gz -C /usr/local/; ln -s /usr/local/artifact /usr/local/artifact;:
#22 0.524 [Error] open /root/.jfrog/jfrog-cli.conf: read-only file system
------
failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = failed to build LLB: executor failed running [/bin/bash -eo pipefail -c jfrog rt dl --flat artifact/${ART_TAG}.tar.gz; set -eux; mkdir -p /usr/local/${ART_TAG}; tar xzf ${ART_TAG}.tar.gz -C /usr/local/; ln -s /usr/local/${ART_VERSION} /usr/local/artifact;]: runc did not terminate sucessfully
The command I use to build the docker image is
DOCKER_BUILDKIT=1 docker build -t imagename . --secret id=jfrog-cfg,src=${HOME}/.jfrog/jfrog-cli.conf (jfrog config exists at ${HOME}/.jfrog/jfrog-cli.conf)
JFrog is working and the artifact I'm downloading exists as I can manually download it outside of using docker.
On Linux, docker is run using the root user, so ${HOME} is /root and not /home/your-user-name or whatever your usual home folder is. Try using explicit full pathnames instead of the env var.

Error while building Docker image for Druid

I am doing this tutorial to load batch data using Apache Hadoop and I try to run this command to build a Docker image named "druid-hadoop-demo" with version tag "2.8.5" :
docker build -t druid-hadoop-demo:2.8.5 .
but it gives me this error
Step 14/53 : RUN curl -s https://archive.apache.org/dist/hadoop/core/hadoop-2.8.3/hadoop-2.8.3.tar.gz | tar -xz -C /usr/local/
---> Running in 7baa699ccc29
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
The command '/bin/sh -c curl -s https://archive.apache.org/dist/hadoop/core/hadoop-2.8.3/hadoop-2.8.3.tar.gz | tar -xz -C /usr/local/' returned a non-zero code: 2
Any help is appreciated.
That's a network error, indicating the file you downloaded was either corrupted in transit (it downloaded correctly for me, so unlikely to be the source), or the connection was dropped before finishing the curl command. Check for network proxies, intermittent network failures, or anything else that could interrupt the connection. You can also try to manually run curl from within a container to see if it's successful, e.g.
curl -o hadoop.tgz https://archive.apache.org/dist/hadoop/core/hadoop-2.8.3/hadoop-2.8.3.tar.gz
tar -tvzf hadoop.tgz

Unexpected token in build output

I'm new to Travis and getting this error in the build output:
Setting environment variables from .travis.yml
$ export DOCKER_COMPOSE_VERSION=1.23.1
0.01s$ source ~/virtualenv/python3.6/bin/activate
$ python --version
Python 3.6.3
$ pip --version
pip 9.0.1 from /home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages (python 3.6)
before_install.1
0.01s$ sudo rm /usr/local/bin/docker-compose
before_install.2
0.13s$ curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-'uname -s'-'uname -m' > docker-compose
before_install.3
0.00s$ chmod +x docker-compose
before_install.4
0.01s$ sudo mv docker-compose /usr/local/bin
install
10.72s$ pip install -r requirements.txt
0.02s$ docker-compose up -d --build
/usr/local/bin/docker-compose: line 1: syntax error near unexpected token `<'
This is strange because there is < nowhere in my docker-compose files. Why am I seeing this error ?
The problem doesn't come from your docker-compose.yml project file but from from the docker-compose file itself, which has not been properly downloaded; namely it is not a binary, but a HTML file (hence the < character you got):
$ export DOCKER_COMPOSE_VERSION=1.24.1
$ curl -L https://github.com/docker/compose/releases/download\
/${DOCKER_COMPOSE_VERSION}/docker-compose-'uname -s'-'uname -m' > docker-compose
$ file docker-compose
docker-compose: HTML document, ASCII text, with CRLF line terminators
$ head docker-compose
<!DOCTYPE html><title>Malformed request</title>
<body>We didn't receive a proper request from your browser. Please contact us if the problem persists.</body>
</html>
To solve this, you should fix your script by using the command substitution $(uname -s), instead of 'uname -s':
$ curl -L https://github.com/docker/compose/releases/download\
/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m) > docker-compose
$ file docker-compose
docker-compose: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (...)

Subshell command in Docker

In a build process I need to call zipalign which is on a certain path in the docker container that I'm using:
$ docker run nathansamson/flutter-builder-docker:v0.7.3 find . -iname zipalign
./opt/android-sdk-linux/build-tools/28.0.1/zipalign
This path can change, if the docker container is updated and there is a new android sdk. For example this could be the path in the future:
$ docker run nathansamson/flutter-builder-docker:v0.9.9 find . -iname zipalign
./opt/android-sdk-linux/build-tools/42.0.0/zipalign
So instead of hardcoding the call to
docker run nathansamson/flutter-builder-docker:v0.7.3 \
/opt/android-sdk-linux/build-tools/28.0.1/zipalign -h
I would like a generic solution that finds the path to zipalign automatically. I have tried it with a subshell
$ docker run nathansamson/flutter-builder-docker:v0.7.3 $(find . -iname zipalign) -h
docker: Error response from daemon: OCI runtime create failed:
container_linux.go:348: starting container process caused "exec: \"-h\":
executable file not found in $PATH": unknown.
ERRO[0001] error waiting for container: context canceled
and with a wildcard for the folder:
$ docker run nathansamson/flutter-builder-docker:v0.7.3 /opt/android-sdk-linux/build-tools/*/zipalign -h
docker: Error response from daemon: OCI runtime create failed:
container_linux.go:348: starting container process caused "exec:
\"/opt/android-sdk-linux/build-tools/*/zipalign\": stat /opt/android-
sdk-linux/build-tools/*/zipalign: no such file or directory": unknown.
ERRO[0001] error waiting for container: context canceled
So subshells and wildcard don't work in Docker. Any ideas how I can find the path to zipalign whenever I'm calling it?
In your Dockerfile you control the entire environment. It's often easiest to cause things to appear in their "natural" places, like /usr/bin. You also have the advantage that, within a single Docker image, there will only be one version of the tools installed.
I might do something like this:
RUN for f in $PWD/opt/android-sdk-linux/build-tools/*/*; do \
ln -s $f /usr/local/bin; \
done
CMD ["zipalign", "-h"]
Another approach that might work is to use a build argument or an environment variable to hold the version number. If you do that then you can set up a known path name.
ARG version
RUN curl -LO http://.../android-sdk-linux-${version}.tar.gz \
&& tar xzf android-sdk-linux-${version}.tar.gz \
&& rm -f android-sdk-linux-${version}.tar.gz \
&& cd opt/android-sdk-linux-build-tools \
&& ln -s ${version} current
CMD ["./opt/android-sdk-linux/build-tools/current/zipalign"]
find can execute something by using the -exec option.
find . -name zipalign -exec bash -c '"$0"' {} \;
In your example:
docker run nathansamson/flutter-builder-docker:v0.7.3 find . -name zipalign -exec bash -c '"$0"' {} \;
If there is nothing that can give you any hints, and you need to just find it, then find will probably do it. Something like:
find /opt -name zipalign -type f
If you can give it more specific starting point, instead of just /opt, then it will run faster.
If you want to execute it (and pass in "-h") in one line, you could do:
$(find /opt -name zipalign -type f) -h

Why can't I pipe a file to "tar" from "curl" with a Docker image for Debian?

Why is the following failing on a Docker image for Debian Jessie?
# curl --silent --show-error --location https://download.owncloud.org/community/owncloud-8.0.3.tar.bz2 | tar xjv
tar (grandchild): bzip2: Cannot exec: No such file or directory
tar (grandchild): Error is not recoverable: exiting now
tar: Child died with signal 13
tar: Error is not recoverable: exiting now
curl: (23) Failed writing body (4096 != 16384)
I can't run that inside Dockerfile RUN statements, or in an interactive bash shell for the image "php:5.6-fpm" (based off "debian:jessie").
I can, however, run it on lots of other Debian and Ubuntu systems.
Is this a problem with Docker?
This error message seems pretty clear:
tar (grandchild): bzip2: Cannot exec: No such file or directory
bzip2 isn't present in the debian:jessie instance, so if you want to use bzip2 compression, you have to install bzip2 first with apt-get install bzip2.

Resources