This is the Dockerfile I created for testing purposes.
FROM ubuntu:latest
MAINTAINER Kapil Gupta "kpgupta98#gmail.com"
RUN apt-get update
RUN apt-get install -y wget
RUN apt-get install -y build-essential tcl8.5
RUN apt-get install -y git
EXPOSE 9999
ENTRYPOINT ["myGit"]
WORKDIR /home
I ran this command for installing the image :
docker build -t mygit .
Output of docker images :
REPOSITORY TAG IMAGE ID CREATED SIZE
mygit latest 1474c446365f 39 minutes ago 414.5 MB
redis latest dc2bd412c10c 7 weeks ago 438.8 MB
ubuntu latest c73a085dc378 9 weeks ago 127.1 MB
Output of docker run -i -t mygit:latest :
docker: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"myGit\\\": executable file not found in $PATH\"\n".
I don't understand what the error means and how to correct it. Please explain the error in your answer too.
The issue is this line:
ENTRYPOINT ["myGit"]
You're telling it to run the command "myGit" when it runs the Dockerfile. That program doesn't exist. The ENTRYPOINT reference is here .
If you just want a shell for your testing, you could just change it to:
ENTRYPOINT ["/bin/bash"]
Related
After reading Dbt documentation, I've had a hard time to figure out how to install dbt-core (or any other packages i.e. dbt-postgres, dbt-snowflake, etc) on Windows 10.
I have Docker Desktop installed, running a couple of containers already (mostly nodeJS containers, and Kafka). However, it was hard to understand how I would have those new Dbt containers available in my Docker Desktop Console.
I can see docker images were installed properly
$docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
**ghcr.io/dbt-labs/dbt-core 1.2.1 802a0d70aedc 4 weeks ago 538MB**
**ghcr.io/dbt-labs/dbt-bigquery 1.2.latest b7502bcd3b35 2 months ago 559MB**
...
postgres latest f8dd270e5152 7 weeks ago 376MB
dpage/pgadmin4 latest d13c9d7d0193 2 months ago 382MB
wurstmeister/kafka latest a692873757c0 4 months ago 468MB
wurstmeister/zookeeper latest 3f43f72cb283 3 years ago 510MB
Does anyone know how to I them to the Desktop Console?
I'm currently on Windows 10 and use a Docker image for my dbt project without needing WSL. Below is my Dockerfile and requirements.txt file with dbt-core and dbt-snowflake but feel free to swap the packages you need.
In my repo, my dbt project is in a folder at the root level named dbt.
requirements.txt
dbt-core==1.1.0
dbt-snowflake==1.1.0
Dockerfile
FROM public.ecr.aws/docker/library/python:3.8-slim-buster
COPY . /dbt
# Update and install system packages
RUN apt-get update -y && \
apt-get install --no-install-recommends -y -q \
git libpq-dev python-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install dbt
RUN pip install -U pip
RUN pip install -r dbt/requirements.txt
# TEMP FIX due to dependency updates. See https://github.com/dbt-labs/dbt-core/issues/4745
RUN pip install --force-reinstall MarkupSafe==2.0.1
# Install dbt dependencies
WORKDIR /dbt
RUN dbt deps
# Specify profiles directory
ENV DBT_PROFILES_DIR=.dbt
# Expose port for dbt docs
EXPOSE 8080
And then you can build and run it (I personally put both of these commands in a dbt_run.sh file and run with bash dbt_run.sh):
docker build -t dbt_image .
docker run \
-p 8080:8080 \
--env-file .env \
-it \
--mount type=bind,source="$(pwd)",target=/dbt \
dbt_image bash
If you make changes to your dbt project while the container is running they will be reflected in the container which makes it great for developing locally. Hope this helps!
I finally was able to pull the image. To add a container in the Docker desktop, I just needed to actually run it.
However, running a dbt-core container in docker, it returns an error:
right after I start the container it stops and returns exit(1), as per the screenshot.
I'm trying to create a docker image of soundcloud/ipmi-exporter to run with Prometheus on Ubuntu Bionic with Docker 19.03.6, build 369ce74a3c. Docker on my OS X laptop is Docker version 20.10.2, build 2291f61. I am forced to build the (customized) image on my laptop because Bionic has a version of golang that's older than what ipmi-exporter wants, and I'm not allowed to update the Ubuntu server.
Anyway, can someone tell me what I'm doing wrong in my Dockerfile?
# Container image
FROM quay.io/prometheus/golang-builder:1.13-base AS builder
ADD . /go/src/github.com/soundcloud/ipmi_exporter/
RUN cd /go/src/github.com/soundcloud/ipmi_exporter && make
# Container image
FROM ubuntu:18.04
WORKDIR /
RUN apt-get update && apt-get install freeipmi-tools -y --no-install-recommends && rm -rf /var/lib/apt/lists/*
COPY --from=builder /go/src/github.com/soundcloud/ipmi_exporter/ipmi_exporter /bin/ipmi_exporter
EXPOSE 8888
ENTRYPOINT ["ipmi_exporter"]
CMD ["--config.file", "/ipmi_remote.yml"]
CMD ["--web.listen-address=":8889"" "--freeipmi.path=/etc/freeipmi" "--log.level="debug""]
When I run the image all I see is
ipmi_exporter: error: unexpected /bin/sh, try --help
I have ipmi_exporter running on the OS directly and I never configured a config.yml. What config.yml is the Dockerfile author talking about? It's mentioned in the last line of https://github.com/soundcloud/ipmi_exporter/blob/master/Dockerfile
The image lives here: https://github.com/soundcloud/ipmi_exporter The sample/example Dockerfile refers to a config.yaml which this software does not use.
I just can't figure out how to make the image pull in the config file I specify.
This Dockerfile:
FROM ubuntu:latest
COPY . /srv/keller
WORKDIR /srv/keller
RUN DEBIAN_FRONTEND=noninteractive apt-get update
results in
Sending build context to Docker daemon 1.167 MB
Step 0 : FROM ubuntu:latest
---> d9fad37da739
Step 1 : COPY . /srv/keller
---> 0691d53a9ddb
Removing intermediate container 76978e260250
Step 2 : WORKDIR /srv/keller
---> Running in 7d47ac19f397
---> 924513b02e82
Removing intermediate container 7d47ac19f397
Step 3 : RUN DEBIAN_FRONTEND=noninteractive apt-get update
---> Running in 97284e8842bc
exec format error
[8] System error: exec format error
on Raspbian GNU/Linux 9. What is the problem here? Note that this is not about entrypoint/command. This error occurs on apt update.
You are trying to run an intel x86 64 image: ubuntu:latest on a raspberry pi (an ARM64), it cannot work out of the box...
Either you can change your base image to be compatible with your host (ex: arm64v8/ubuntu).
Or you can install qemu:
apt install -y qemu qemu-system-x86 binfmt-support qemu-user-static
and register it in docker:
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
This happened to me while setting up pod in the cloud that runs Debian, while my machine is M1. I had to push some images to a private docker repo, but when I pushed them, I noticed the uploaded ones where not compatible with the architecture of the pod in the cluster.
My fix was pulling the correct image docker pull --platform=linux/amd64 python:3.9.16-buster and then using that one istead of the pulled by just doing docker pull --platform=linux/amd64 python:3.9.16-buster.
you are missing the export and a semi-colon, this should be
RUN export DEBIAN_FRONTEND=noninteractive; apt-get update
or you can use the && syntax
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update
I have Ubuntu 18 running on an AWS server. Within that server I have a Docker image that I want to change the code for while it is still running.
ubuntu#ip-172-31-6-79:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
fc latest 20949d0fd7ec 7 days ago 1.74GB
debian latest 8d31923452f8 5 weeks ago 101MB
ekholabs/face-classifier latest b1a390b8ec60 21 months ago 1.77GB
In order to change the code I ran the following command
ubuntu#ip-172-31-6-79:~$ docker run -it fc bash
But I get the following error
python3: can't open file 'bash': [Errno 2] No such file or directory
How do I go about fixing this so I can edit the code within the Docker image. As a side note here is the Dockerfile
FROM debian:latest
RUN apt-get -y update && apt-get install -y git python3-pip python3-dev python3-tk vim procps curl
#Face classificarion dependencies & web application
RUN pip3 install numpy scipy scikit-learn pillow tensorflow pandas h5py opencv-python==3.2.0.8 keras statistics pyyaml pyparsing cycler matplotlib Flask
ADD . /ekholabs/face-classifier
WORKDIR ekholabs/face-classifier
ENV PYTHONPATH=$PYTHONPATH:src
ENV FACE_CLASSIFIER_PORT=8084
EXPOSE $FACE_CLASSIFIER_PORT
ENTRYPOINT ["python3"]
CMD ["src/web/faces.py"]
The problem is on your dockerfile you use an
ENTRYPOINT ["PYTHON3"]
which means when you run
docker run -it fc bash
it gets converted inside container to "python3 bash" this is why you have an error
python3: can't open file 'bash': [Errno 2] No such file or directory
Try remove the ENTRYPOINT
Hope that resolve the problem.
I am using windows 7. In my home folder I made a new directory Docker. And inside that I made new directory rails.
This is my docker file: (Docker/rails/Dockerfile)
FROM alpine:3.2
MAINTAINER xxx <xxx#xxx.in>
ENV BUILD_PACKAGES bash curl-dev ruby-dev build-base
ENV RUBY_PACKAGES ruby ruby-io-console ruby-bundler
# Update and install all of the required packages.
# At the end, remove the apk cache
RUN apk update && \
apk upgrade && \
apk add $BUILD_PACKAGES && \
apk add $RUBY_PACKAGES && \
rm -rf /var/cache/apk/*
RUN mkdir /usr/app
WORKDIR /usr/app
COPY Gemfile /usr/app/
COPY Gemfile.lock /usr/app/
RUN bundle install
COPY . /usr/app
And then I changed directory to Docker. On ls it shows rails.
Then I typed this command:
docker build rails
Now the image name is alpine. I made a tag to rails like this:
docker tag <imageid> myname/rails
Problem:
The image is successfully build and I have a repository rails and pushed it successfully. I am able to pull it as well.
Till now everything is fine, but then I run this command:
docker run -i -t xxx/rails /bin/bash
It gives me this error:
C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: oci runtime error: exec: "/bin/bash": stat /bin/bash: no such file or directory.
So I am stuck there.
My Objective:
I want to run this command successfully:
rails -v
To run that command I need to install the image, and I don't know how to install the image, I have been following up numerous tutorials since last week.
I am new to docker. This is my first docker image.
Edit:
docker exec -it sh
Alpine does not come with bash by default, only /bin/sh so you should change your command to:
docker run -i -t vikaran/rails sh
Also worth noting you can run:
docker build -t myname/rails rails
To automatically tag the image when building it.