Sawtooth-supply-chain /bin/sh: 1: bin/splice_json: Permission denied - blockchain

I am trying to run sawtooth-supply-chain from my own computer to get a better understanding of the environment. However, I've run into an issue after running
docker-compose up
git clone https://github.com/hyperledger/sawtooth-supply-chain
cd sawtooth-supply-chain
git diff 50c404c >bionic.patch
patch --dry-run -R -p1 <bionic.patch
patch -R -p1 <bionic.patch
sudo docker-compose up
I am now running into an error at step 9/11 which is the splice_JSON file build
Step 9/11 : RUN mkdir /node_deps && bin/splice_json asset_client/package.json fish_client/package.json server/package.json > /node_deps/package.json && cd /node_deps && npm install && cd - && ln -s /node_deps/node_modules asset_client/ && ln -s /node_deps/node_modules fish_client/ && ln -s /node_deps/node_modules server/
---> Running in ed3fb485568e
/bin/sh: 1: bin/splice_json: Permission denied
Service 'shell' failed to build: The command '/bin/sh -c mkdir /node_deps && bin/splice_json asset_client/package.json fish_client/package.json server/package.json > /node_deps/package.json && cd /node_deps && npm install && cd - && ln -s /node_deps/node_modules asset_client/ && ln -s /node_deps/node_modules fish_client/ && ln -s /node_deps/node_modules server/' returned a non-zero code: 126
I tried to do chmod 777 /bin/splice_json and run git bash on elevated
Any assistance is appreciated

Running patch may have removed executible permission from one or more files under ./bin. Before running docker-compose, restore execute permission on all ./bin/* files:
chmod +x ./bin/*

Related

How to install brew into a Dockerfile (`brew: not found`)

Rather than necro-post on a two-year old thread, I decided to create a new question.
I want add brew (homebrew) to a Docker container, but I get a brew: not found error.
The suggested solution in that previous article doesn't seem to work. This new Dockerfile...
FROM rust:1.63.0-buster
WORKDIR app
RUN apt-get update && \
apt-get install -y -q --allow-unauthenticated \
git \
sudo
RUN useradd -m -s /bin/zsh linuxbrew && \
usermod -aG sudo linuxbrew && \
mkdir -p /home/linuxbrew/.linuxbrew && \
chown -R linuxbrew: /home/linuxbrew/.linuxbrew
USER linuxbrew
RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
USER root
RUN chown -R $CONTAINER_USER: /home/linuxbrew/.linuxbrew
RUN brew install hello
gives this error... What am I missing? Thanks.
=> ERROR [6/6] RUN brew install hello 0.2s
------
> [6/6] RUN brew install hello:
#9 0.181 /bin/sh: 1: brew: not found
------
executor failed running [/bin/sh -c brew install hello]: exit code: 127
This Dockerfile installs brew in /home/linuxbrew/.linuxbrew/bin/brew. Including that directory in the path (with the ENV command) does the trick.
...
ENV PATH="/home/linuxbrew/.linuxbrew/bin:${PATH}"
RUN brew install hello

Run conda inside singularity

I would like to run a conda command with singularity.
The command is:
singularity exec ~/dockerimage.sif conda
It yields an error:
/.singularity.d/actions/exec: 9: exec: conda: Permission denied
Here is my dockerfile:
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y apt-utils wget=1.20.3-1ubuntu1 python3.8=3.8.2-1ubuntu1.2 python3-pip=20.0.2-5ubuntu1 python3-yaml=5.3.1-1 git=1:2.25.1-1ubuntu3
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-py38_4.8.3-Linux-x86_64.sh && chmod +x Miniconda3-py38_4.8.3-Linux-x86_64.sh && ./Miniconda3-py38_4.8.3-Linux-x86_64.sh -b && cp /root/miniconda3/bin/conda /usr/bin/conda
RUN wget https://data.qiime2.org/distro/core/qiime2-2020.8-py36-linux-conda.yml && conda env create -n qiime2-2020.8 --file qiime2-2020.8-py36-linux-conda.yml && conda install -y -n qiime2-2020.8 -c conda-forge -c bioconda -c qiime2 -c defaults q2cli q2template q2-types q2-feature-table q2-metadata vsearch snakemake
What should I add to the Dockerfile? How would it work?
You're installing with conda default settings, which puts it in the home of the current user. That user is root. Singularity runs as your current user, so unless you're running as root the conda files will not be available.
modify your conda install command to set the install prefix: -p /opt/conda (or some other arbitrary location)
make sure that any user will be able to access the files installed with conda: chmod -R o+rX /opt/conda
update PATH to include conda: export PATH="$PATH:/opt/conda/bin"
when running your image make sure your environment variables are not overriding those in the container: singularity exec --cleanenv ~/dockerimage.sif conda

How to install uWebSockets?

I am running ubuntu on my window 10 through VMware. Because the Udacity course needs uWebSockets to run the simulator.
here is the step the class given to install it:
run chmod a+x install-linux.sh
this is the install-linux.sh file in the same directory
#!/bin/bash
source /etc/os-release || echo 'Warning: /etc/os-release was not found'
if [[ " $ID_LIKE " == *' archlinux '* ]]; then
sudo pacman -S git libuv openssl gcc cmake make
else
if [[ ! " $ID_LIKE " == *' debian '* ]]; then
echo 'Warning: unidentified Linux distribution, assuming Debian-like'
fi
sudo apt-get update
sudo apt-get install git libuv1-dev libssl-dev gcc g++ cmake make
fi
git clone https://github.com/uWebSockets/uWebSockets
cd uWebSockets
git checkout e94b6e1
mkdir build
cd build
cmake ..
make
sudo make install
cd ../..
sudo ln -s /usr/lib64/libuWS.so /usr/lib/libuWS.so
sudo rm -r uWebSockets
But when I try the command in the terminal, nothing happened.
Is anybody can provide some help?
All chmod a+x install-linux.sh does is change the file permissions of install-linux.sh so that it is executable. So I wouldn't expect to see anything in the terminal.
I expect that after changing the file permissions that you are supposed to run the script like this
./install-linux.sh

docker curl return unexpected end of file

I'm working to deploy my maven project at IBMCloud from Centos Machine, build completed successfully but while executing the run command "ibmcloud dev run --trace" I'm getting this error
/bin/sh: 1: curl: not found
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
The command '/bin/sh -c mkdir -p /usr/share/maven /usr/share/maven/ref && curl -fsSL http://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar -xzC /usr/share/maven --strip-components=1 && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn' returned a non-zero code: 2
FAILED
An error exit status 2 was encountered while building the Docker image.
Dockerfile content
FROM ibmjava:8-sfj
LABEL maintainer="IBM Java Engineering at IBM Cloud"
COPY com.project.presentation/target/com.project.war /app.war
ARG MAVEN_VERSION=3.5.4
ARG USER_HOME_DIR="/root"
RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
&& curl -fsSL http://apache.osuosl.org/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \
| tar -xzC /usr/share/maven --strip-components=1 \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
ENV MAVEN_HOME /usr/share/maven
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
COPY mvn-entrypoint.sh /usr/local/bin/mvn-entrypoint.sh
COPY settings-docker.xml /usr/share/maven/ref/
VOLUME "$USER_HOME_DIR/.m2"
ENV JAVA_OPTS=""
ENTRYPOINT [ "sh", "-c", "mvn -pl com.project.presentation -am spring-boot:run" ]
I updated the dockerfile based on the suggestions on this link to have settings-docker.xml and mvn-entrypoint.sh copied Docker image with Maven fails to run
The image does not have curl installed on it. you can check that by simply writing simple Dockerfile as below
FROM ibmjava:8-sfj
RUN curl google.com
Now, this will fail giving below error
...
Status: Downloaded newer image for ibmjava:8-sfj
---> e00902e30a47
Step 2/2 : RUN curl google.com
---> Running in 6b08c670fad2
/bin/sh: 1: curl: not found
The command '/bin/sh -c curl google.com' returned a non-zero code: 127
Install curl on your image by adding following line
RUN apk add --update \
curl \
&& rm -rf /var/cache/apk/*

Program can't find Boost Graph installed in Docker

I am using dockers to store the dependencies of my c++ program to use when doing CI testing with gitlab CI. I first build a base docker which contains all of the program dependencies (lets call it DOCKER_A):
FROM gcc:5
RUN mkdir -p /usr/src/optimization
WORKDIR /usr/optimization
#COPY . /usr/optimization
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y build-essential && \
apt-get install -y openssh-client && \
apt-get install -y python3 && \
apt-get install -y python3-pip && \
pip3 install --upgrade pip && \
pip3 install virtualenv
RUN wget http://www.cmake.org/files/v3.7/cmake-3.7.2.tar.gz && \
tar xf cmake-3.7.2.tar.gz && \
cd cmake-3.7.2/ && \
./configure && \
make && \
make install && \
export PATH=/usr/local/bin:$PATH && \
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH && \
cd ..
RUN wget -O boost_1_64_0.tar.gz http://sourceforge.net/projects/boost/files/boost/1.64.0/boost_1_64_0.tar.gz/download && \
tar xzvf boost_1_64_0.tar.gz && \
cd boost_1_64_0 && \
./bootstrap.sh --exec-prefix=/usr/local --with-python=python3 && \
./b2 threading=multi && \
./b2 install threading=multi && \
cd .. && \
rm boost_1_64_0.tar.gz && \
rm -r boost_1_64_0 && \
ln -s /usr/lib/x86_64-linux-gnu/libboost_python-py34.so /usr/lib/x86_64-linux-gnu/libboost_python3.so
This docker doesn't change. Then every time I push to gitlab, I build another docker, starting from DOCKER_A:
FROM DOCKER_A
ARG SSH_PRIVATE_KEY
WORKDIR /usr/optimization
COPY . /usr/optimization
RUN chmod +x ADD_KEY.sh
RUN ./ADD_KEY.sh "$SSH_PRIVATE_KEY"
RUN mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=on .. && \
make && \
cd ..
This builds the code from the new commit (up to this point everything works as expected).
Next, in my YAML file for gitlab CI, I run my tests, which consist of calling the executable files generated by my build process.
before_script:
- docker info
- docker login -u user -p $CI_JOB_TOKEN docker.registry.url
after_script:
- echo "After script section"
- echo "For example you might do some cleanup here"
buildRelease:
stage: build
script:
- echo "Do your build here"
- docker login -u user -p $CI_JOB_TOKEN docker.registry.url
- docker build --pull -i $CONTAINER_IMAGE_PUSH --build-arg SSH_PRIVATE_KEY="$SSH_PRIVATE_KEY" .
- docker push $CONTAINER_IMAGE_PUSH
testDispatch:
stage: test
script:
- echo "Do a test here"
- echo "For example run a test suite"
- docker run -t $CONTAINER_IMAGE_PULL ./bin/dispatch
testState:
stage: test
script:
- docker run -t $CONTAINER_IMAGE_PULL ./bin/state-test
testAlgorithm:
stage: test
script:
- docker run -t $CONTAINER_IMAGE_PULL ./bin/algorithm-test
testSystem:
stage: test
script:
- docker run -t $CONTAINER_IMAGE_PULL ./bin/system-test
Each of these the tests in stage test fails, all giving the same error. Here is an example of the output:
$ docker run -t $CONTAINER_IMAGE_PULL ./bin/algorithm-test
./bin/algorithm-test: error while loading shared libraries:
libboost_graph.so.1.64.0: cannot open shared object file: No such file or directory
I don't understand why my binary cannot find libboost graph, as it is installed in the first docker container, which I am inheriting from.
Any help that could be provided would be appreciated.