Reputation: 5655
I am trying to run a docker image
Dockerfile
FROM marketplace.gcr.io/google/ubuntu1804:latest
MAINTAINER Vinay Joseph ([email protected])
LABEL ACI_COMPONENT="License Server"
EXPOSE 20000/tcp
#Install Unzip
RUN apt-get install unzip
#Unzip License Server to /opt/MicroFocus
RUN mkdir /opt/MicroFocus
RUN cd /opt/MicroFocus
#Download the License Server
RUN curl -O https://storage.googleapis.com/software-idol-21/LicenseServer_12.1.0_LINUX_X86_64.zip
RUN chmod 777 LicenseServer_12.1.0_LINUX_X86_64.zip
RUN unzip LicenseServer_12.1.0_LINUX_X86_64.zip
cloudbuild.yaml
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/xxxx/idol-licenseserver', '.']
images:
- 'gcr.io/xxxx/idol-licenseserver'
The message i get is
docker run gcr.io/xxxx/idol-licenseserver
/bin/sh: 0: -c requires an argument
Upvotes: 2
Views: 1955
Reputation: 9542
ENTRYPOINT ["/bin/sh", "-c"]
is the default entrypoint in every Dockerfile if you do not choose your own entrypoint. If you run the Dockerfile, add a command of your choice that you would like to run. At best just try bash
:
docker run -it gcr.io/xxxx/idol-licenseserver bash
Without adding any command, the container does not know what to run in the command line but still starts the bash (sh in this case) to run something, waiting for a command = -c requires an argument
.
Upvotes: 0
Reputation: 8636
There are a couple of problems with your Dockerfile
RUN apt-get install unzip
A good practice is to perform an update
before installing packages, otherwise you could fall into situation with missing package lists.
RUN apt-get update && apt-get install -y ...
RUN mkdir /opt/MicroFocus
RUN cd /opt/MicroFocus
This is mistake because cd
doesn't work between layers (different RUN
commands). What you wanted is achieved with single WORKDIR
command
WORKDIR /opt/MicroFocus
The error message that you are facing means that base image is configured with something like ENTRYPOINT ["sh", "-c"]
therefore expecting you to provide initial command line when launching this image. You have to define the proper startup command and append it to your command after image name.
Upvotes: 3