Docker Build: xz(stdin): File format not recognized - docker

Hi total Docker noob here, is there a dependency i can run so this error goes away?
Step 19/40 : RUN curl -OL https://www.haskell.org/ghc/dist/${ghc%[a-z]}/ghc-${ghc}-x86_64-deb7-linux.tar.xz | tar -xJf- && cd ghc-${ghc} && ./configure && make install
---> Running in 0141996d759f
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 161 100 161 0 0 335 0 --:--:-- --:--:-- --:--:-- 336
100 85.5M 100 85.5M 0 0 308k 0 0:04:44 0:04:44 --:--:-- 358k
xz: (stdin): File format not recognized
tar: Child returned status 1
tar: Error is not recoverable: exiting now
The command '/bin/sh -c curl -OL https://www.haskell.org/ghc/dist/${ghc%[a-z]}/ghc-${ghc}-x86_64-deb7-linux.tar.xz | tar -xJf- && cd ghc-${ghc} && ./configure && make install' returned a non-zero code: 2

The problem is the -O option to curl that writes to disk instead of stdout.
Try with: curl -L https://...

Related

Docker container says file isn't found, even though ls shows it there

In my Dockerfile, I have the following:
git clone https://github.com/gdraheim/docker-systemctl-replacement /opt/systemctl-github && \
rm /usr/bin/systemctl && \
ln -s /opt/systemctl-github/files/docker/systemctl.py /usr/bin/systemctl && \
ls -lh /usr/bin/systemctl && \
/usr/bin/systemctl stop amazon-ssm-agent && \
However, when the docker container is being built, it complains about not being able to find /usr/bin/systemctl. The command right before it calls ls on it, which shows it in the docker build process, so not quite sure I understand why.
Here's what the docker build shows:
Cloning into '/opt/systemctl-github'...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed100 29.6M
100 29.6M 0 0 14.1M 0 0:00:02 0:00:02 --:--:-- 14.1M
lrwxrwxrwx 1 root root 47 Dec 12 21:04 /usr/bin/systemctl -> /opt/systemctl-github/files/docker/systemctl.py
/bin/sh: 1: /usr/bin/systemctl: not found
Any idea why this is saying /usr/bin/systemctl is not found, although ls shows it right there in the output?

Why is WLP installUtility not able obtain assets from feature repo?

I am running docker build with following Dockerfile, with main idea to use feature repo as described https://github.com/WASdev/ci.docker#installing-liberty-features-from-local-repository-19008:
FROM websphere-liberty-kernel-ubi-min:19.0.0.9
COPY usr/ /opt/ibm/wlp/usr/
USER root
ARG FEATURE_REPO_URL=http://xyz.openshift.local/19.0.0.9/repo.zip
ARG VERBOSE=true
RUN configure.sh
RUN chown -R 1001:0 /tmp \
&& chmod -R g+rw /tmp \
&& chown -R 1001:0 /opt/ibm/wlp/output \
&& chmod -R g+rw /opt/ibm/wlp/output \
&& chown -R 1001:0 /opt/ibm/wlp/usr/servers/defaultServer \
&& chmod -R g+rw /opt/ibm/wlp/usr/servers/defaultServer \
&& chown -R 1001:0 /opt/ibm/wlp/usr/shared/resources \
&& chmod -R g+rw /opt/ibm/wlp/usr/shared/resources
USER 1001
Docker build output shows that repo.zip is downloaded and missing features are detected:
+ '[' http://xyz.openshift.local/19.0.0.9/repo.zip ']'
+ curl -k --fail http://xyz.openshift.local/19.0.0.9/repo.zip % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 14 311M 14 44.8M 0 0 55.0M 0 0:00:05 --:--:-- 0:00:05 54.9M 31 311M 31 99.4M 0 0 54.8M 0 0:00:05 0:00:01 0:00:04 54.7M 49 311M 49 152M 0 0 54.2M 0 0:00:05 0:00:02 0:00:03 54.2M 66 311M 66 207M 0 0 54.4M 0 0:00:05 0:00:03 0:00:02 54.4M 83 311M 83 260M 0 0 54.0M 0 0:00:05 0:00:04 0:00:01 54.0M 99 311M 99 310M 0 0 53.4M 0 0:00:05 0:00:05 --:--:-- 53.1M100 311M 100 311M 0 0 53.4M 0 0:00:05 0:00:05 --:--:-- 52.7M
+ installUtility install --acceptLicense defaultServer --from=/tmp/repo.zip
Checking for missing features required by the server ...
The server requires the following additional features: mpconfig-1.3 transportsecurity-1.0 cdi-2.0 mpopenapi-1.0 jaxws-2.2 jsonp-1.1 jpa-2.2 mprestclient-1.3 mphealth-2.1 wssecurity-1.1 jaxrs-2.1. Installing features from the repository ...
Successfully connected to the configured repository.
but then installation of all features fails:
Preparing assets for installation. This process might take several minutes to complete.
CWWKF1259E: Unable to obtain the following assets: mpconfig-1.3 transportsecurity-1.0 cdi-2.0 mpopenapi-1.0 jaxws-2.2 jsonp-1.1 jpa-2.2 mprestclient-1.3 mphealth-2.1 wssecurity-1.1 jaxrs-2.1. Ensure that the specified assets are valid. To find the IDs of applicable assets, run the installUtility find command.
I have taken a look in downloaded repo.zip and I can find following file (that should match one of the missing features):
So, what is the reason for the error?
Using different image (ibmcom/websphere-liberty:some21.0.0.3version) and pointing FEATURE_REPO_URL to place where 21.0.0.3 repo is hosted works.
So whoever prepared 19.0.0.3 image for me and said which feature repo to use, pointed me to some incompatible artefacts.
What is interesting, when I combined different versions of image vs repo, configure.sh was nicely verbose (it explained there is incompatibility), but this error CWWKF1259E: Unable to obtain the following assets is really unhelpful.

Why docker run saying Unknown operand whilst same shell script runs perfectly in ubuntu machine

I am trying to execute a ./login.sh as a part of docker run now when i run the ./login.sh in ubuntu machine i see success response but when i create a docker image i see output as sh: abc: unknown operand “invalid url”
Here is contents of ./login.sh
#!/bin/sh
# Black Box Tester!
content=$(curl --location --request POST "https://api.platform.abc.com.
/auth/oauth/token" --header 'Content-Type: application/x-www-form-
urlencoded' \
--header 'Authorization: Basic V0zSA==' --data-raw 'grant_type=password&
username=test#example.com&password=123456'| jq -r '.domain_id' )
if [ $content = abc ]
then
echo “Valid Login Token”
else
echo “invalid url”
fi
and here is contents of docker file
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y curl \
&& apt-get -y install jq
FROM openjdk:8-jre-alpine
RUN apk --no-cache add curl jq
WORKDIR /opt
ADD login.sh /opt
RUN pwd \
&& find /opt
CMD ["./login.sh"]
When same ./login.sh i execute normally in Ubuntu machine i get successful output as
ubuntu#ip-172-31-29-248:~$ ./login.sh
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left Speed
100 2034 100 1958 100 76 9458 367 --:--:-- --:--:-- --:--:--
9873
“Valid Login Token”
Here is output of sudo docker run lots/loginimage
ubuntu#ip-172-31-29-248:~$ sudo docker run lots/loginimage
./login.sh: line 6: jq: not found
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left Speed
92 2034 92 1807 100 76 7199 302 --:--:-- --:--:-- --:--:--
7501
curl: (23) Failed writing body (0 != 1024)
sh: abc: unknown operand
“invalid url”
Can some one let me know why the login script which is simply a curl command runs sucessfully in ubuntu machine but same login script shows else condition in docker run?
Also i have included a code in docker file to download and install Json path jq but why image still says ./login.sh: line 6: jq: not found??
your help is highly appreciated
While creating docker you need to install jq sudo apt-get install jq

Docker build: returned a non-zero code: 1

This line causes my docker build to fail. I've tried splitting it up but get different errors. What would be the proper way to define this line?
ARG lame=3.99.5
RUN curl -L http://sourceforge.net/projects/lame/files/lame/3.99/lame-${lame}.tar.gz | tar -xzf- && \
cd lame-${lame} && \
./configure && make install
I get this error:
Step 13/38 : RUN curl -L http://sourceforge.net/projects/lame/files/lame/3.99/lame-${lame}.tar.gz | tar -xzf- && cd lame-${lame} && ./configure && make install
---> Running in 1d9635c2e249
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 178 100 178 0 0 456 0 --:--:-- --:--:-- --:--:-- 456
0 345 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
0 15608 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0
0 341 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0
100 1411k 100 1411k 0 0 166k 0 0:00:08 0:00:08 --:--:-- 334k
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for style of include used by make... GNU
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/src/lame-3.99.5':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
The command '/bin/sh -c curl -L http://sourceforge.net/projects/lame/files/lame/3.99/lame-${lame}.tar.gz | tar -xzf- && cd lame-${lame} && ./configure && make install' returned a non-zero code: 1

ERROR: Could not find 'which' command, make sure it's available first before continuing installation

I'm trying to deploy rails application in Cent-OS. When I run curl -L get.rvm.io | bash -s stable to setup ruby environment.
I got the following output
[root#186-aven-vps marketeurepo]# curl -L get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 184 100 184 0 0 581 0 --:--:-- --:--:-- --:--:-- 580
100 22721 100 22721 0 0 35092 0 --:--:-- --:--:-- --:--:-- 35092
ERROR: Could not find 'which' command, make sure it's available first before continuing installation.
I'm using Mac OS X on local machine and I'm new to this.Any suggestion will be appreciated.Thank you.
I solved it by running this command:
$ yum install which

Resources