I have a docker image which is running docker host with ubuntu 14.04.
In one of the containers, I am trying to run zookeeper and install librdkafka libraries(pre-requisite library) for kafka to connect to 3rd party software. I need the 'make' command to build my librdkafka libraries inside the container from where I will be running the kafka adapters/connectors.
However, interestingly I am not able to run 'make' command inside the container, it works perfectly on the docker host. When i try using
apt-get install make
I get the following message which is not making much sense to me:
root#svi-esp-service:/# apt-get install make
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package make is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'make' has no installation candidate
Can someone help me to understand why the make is not getting installed in the container and why cant i run it? I am behind time and need this command running in the container..its really annoying.
Just as a heads up, I have following in the list file:
root#svi-esp-service:/# cat /etc/apt/sources.list
deb http://http.debian.net/debian jessie main
deb http://http.debian.net/debian jessie-updates main
deb http://security.debian.org jessie/updates main
Help really appreciated!
Update APT's package lists by running apt-get update first:
apt-get update && apt-get install make
RUN apt install build-essential -y --no-install-recommends
I recommend apt over apt-get
This will not only install 'make' but others as well, likely needed for development.
-y and --no-install-recommends so it won't block build ;)
Related
I had to compile a custom kernel to get Ubuntu to run on my laptop and now I'm trying to run docker containers on it.
It generated packages I installed:
linux-headers-5.15.30-25.25custom_5.15.30-25.25custom-1_amd64.deb
linux-image-5.15.30-25.25custom-dbg_5.15.30-25.25custom-1_amd64.deb
linux-image-5.15.30-25.25custom_5.15.30-25.25custom-1_amd64.deb
Now when I try to create docker images I get the following error:
...
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package linux-headers-5.15.30-25.25custom
E: Couldn't find any package by glob 'linux-headers-5.15.30-25.25custom'
E: Couldn't find any package by regex 'linux-headers-5.15.30-25.25custom'
The Dockerfile just pulls an nvidia image and adds some other packages required
FROM nvidia/cuda:11.4.2-devel-ubuntu18.04
ARG COMPILE_GRAPHICS=OFF
ARG DEBIAN_FRONTEND=noninteractive
USER root
RUN \
set -ex && \
apt-key update && \
apt-get update && \
apt-get install -y -q \
build-essential \
software-properties-common \
openssl \
curl && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/apt/archives/ && \
rm -rf /usr/share/doc/ && \
rm -rf /usr/share/man/
...
It is installed on the host PC
~$ sudo dpkg -l | grep linux-headers-5.15.30-25.2
ii linux-headers-5.15.30-25.25custom 5.15.30-25.25custom-1 amd64 Linux kernel headers for 5.15.30-25.25custom on amd64
There's no problem on other machines using the upstream Ubuntu kernel packages.
So guess docker needs the actual package. How can I add a custom location to fetch the packages?
Thanks
I get the feeling you are mixing up what is outside and inside of a container.
Outside - on your host operating system you had to compile a custom kernel to get Linux running. So far so good.
Now you are trying to build a docker container. So the next steps are happening inside the container. Docker is lightweight virtualization therefore the container runs on the same kernel as the host. Since some package dependency is on the kernel's headers, and apt is trying to install the Debian package for them but cannot find them. Seems obvious as you are running a custom kernel and the package is in none well-known repository.
To get out of the situation:
check whether the headers for your kernel are available as .deb
make that .deb available inside the container. This may happen by placing them into the Docker build context.
ensure your Dockerfile installs the .deb before installing whatever needs that .deb. This will prevent it is searched in online repositories.
As the title says when I try to run an 'apt-get -y update' command when building my Robotframework Dockerfile I get the error below:
/bin/sh: apt-get: not found
executor failed running [/bin/sh -c apt-get -y update]: exit code: 127
Can anyone help in explaining why this is the case as per my understanding this should run due to the Debian Buster base?
According to the docker layers on the docker-hub site, it seems, that they decided to use Alpine Linux instead of Debian.
While adding new packages they used apk instead of apt-get, as can be seen here.
So you may want to use apk update instead of apt-get update
When I run the following code, I get this error, E: Unable to locate package hadoop
FROM ubuntu:20.04
RUN apt-get update -y \
&& apt-get install -y apt-utils \
&& apt-get install python3.8 -y
RUN apt-get install jupyter -y
RUN apt-get install hadoop -y
RUN rm -rf /var/lib/apt/lists/*
ADD sample.py /
LABEL maintainer=Ammar
CMD [ "python", "./sample.py" ]
This link: https://computingforgeeks.com/install-apache-hadoop-hbase-on-ubuntu-linux/ contains full example of Hadoop installation. I think the same should be done in Docker step-by-step.
apt-get install hadoop not working in ubuntu without adding external repositories. But if you know external repo, then you must add softwaree-properties-common package (like this: https://stackoverflow.com/a/52091668/1852444)
and then add your repository by apt-add-repository command.
Some "foss" softwares and Softwares which do not comes under foss are not added in ubuntu repository so they cannot be install using apt because apt use these repositories to install package.
hadoop is one of these packages which is not added to ubuntu repo. For more info about repository you can check here
You can pull and use one of the hadoop container image created and pushed in dockerhub by others instead of creating it for scratch.
If you still want to create your own hadoop container image you can check out this example hadoop dockerfile
I am doing a docker build on my MacBook Pro and it always keeps failing with following error:
Reading package lists...
Building dependency tree...
Reading state information...
Suggested packages:
zip
The following NEW packages will be installed:
unzip
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 170 kB of archives.
After this operation, 547 kB of additional disk space will be used.
Err:1 http://deb.debian.org/debian stretch/main amd64 unzip amd64 6.0-21+deb9u1
404 Not Found
E: Failed to fetch http://deb.debian.org/debian/pool/main/u/unzip/unzip_6.0-21+deb9u1_amd64.deb 404 Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get install unzip' returned a non-zero code: 100
docker version:
Docker version 19.03.8, build afacb8b
MacOS: Mojave 10.14.6
Dockerfile snippet:
FROM debian:latest
RUN apt-get update
RUN apt-get install -y ca-certificates
RUN apt-get install unzip
The build works fine in our travis CI which is using docker-ce=17.09.0~ce-0~ubuntu
Any suggestions on how to debug it further? Initially we thought it may be a temporary issue on debian side but the problem has persisted so likely an issue with my environment.
Combine the three RUN lines you show into a single command:
FROM debian:latest
RUN apt-get update \
&& apt-get install -y \
ca-certificates \
unzip
There's a combination of two things that leads to that 404 error. On the one hand, Docker will cache individual Dockerfile steps: it sees that, starting from debian:latest, it's already RUN apt-get update, so it uses the version of that command from yesterday. On the other hand, Debian updates their repositories fairly frequently with very minor updates (see the +deb9u1 part of that version number) and when they do they delete the previous version from their repositories. This combination means you can be in a sequence where you're using a cached version of the apt-get update index, but the package version it mentions doesn't exist any more.
Combining these lines together like this means Docker will always run both apt-get update and apt-get install together; if you add a package to the list it will re-run the update step before trying to download things. That avoids this problem, at the cost of a little extra download time when the package list changes.
I'm getting an error during build. I've seen many similar questions but nothing seems to solve this issue.
I'm running Docker (Version 17.06.0-ce-mac18) on OS X El Capitan.
My Dockerfile is:
FROM ubuntu:14.04
RUN apt-get update && apt-get install -y -q git
I'm getting Bad Request 400 error from one of git dependencies:
Get:38 http://archive.ubuntu.com/ubuntu/ trusty-updates/main patch amd64 2.7.1-4ubuntu2.3 [86.4 kB]
Fetched 7619 kB in 5s (1367 kB/s)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libx/libx11/libx11-data_1.6.2-1ubuntu2_all.deb 400 Bad Request [IP: 91.189.88.162 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get update && apt-get install -y -q git' returned a non-zero code: 100
Any explanations or ideas for workaround?
I think the mirror being used is not reachable at the moment,
You can try changing mirrors in for ubuntu from your docker file using sed.
You can also use ubuntu's mirror protocol, which will fetch mirrors located within your country:
FROM ubuntu:14.04
RUN sed -i -e 's/http:\/\/archive/mirror:\/\/mirrors/' -e 's/\/ubuntu\//\/mirrors.txt/' /etc/apt/sources.list
RUN apt-get update && apt-get install -y -q git
You can even specify a specific mirror you want to be used in the same way.
For more information about apt mirrors refer to this post
I think the problem come from the fact that you are using ubuntu:14.04 which is deprecated (https://askubuntu.com/questions/731891/not-able-to-install-anything-and-update-on-ubuntu-14-10)
Can you try with FROM ubuntu ? This will use the latest ubuntu image, which is 16.04.
EDIT: Ubuntu 14.04 is an LTS, so as pointed by #jwodder it should still be supported. I would still try to use the latest LTS (16.04) with FROM ubuntu as it might be an easy fix.