This question already has an answer here:
Can not install package within docker debian:jessie
(1 answer)
Closed 1 year ago.
I'm trying to install soundfile over pip install on my docker container. Sadly i need to install libsndfile1 manually over apt get by myself. This fails somehow and i don't really get why and does anyone know how to install it.
I'm running docker desktop on Win10 - but container will finally run on a Linux machine.
> [ 7/11] RUN apt-get install libsndfile1:
#11 0.618 Reading package lists...
#11 1.814 Building dependency tree...
#11 2.219 Reading state information...
#11 2.829 The following additional packages will be installed:
#11 2.830 libflac8 libogg0 libvorbis0a libvorbisenc2
#11 2.942 The following NEW packages will be installed:
#11 2.944 libflac8 libogg0 libsndfile1 libvorbis0a libvorbisenc2
#11 2.956 0 upgraded, 5 newly installed, 0 to remove and 3 not upgraded.
#11 2.956 Need to get 669 kB of archives.
#11 2.956 After this operation, 2136 kB of additional disk space will be used.
#11 2.956 Do you want to continue? [Y/n] Abort.
------
executor failed running [/bin/sh -c apt-get install libsndfile1]: exit code: 1
Anyone know something?
Use the command with an automatic yes to make it run non-interactively.
RUN apt-get --yes install libsndfile1
And FYI - this dangerous --force-yes option too is available.
Use with absolute discretion if necessary.
Read about apt-get options here.
Related
I'm trying to build a Docker image based on ruby:3.0. Inside Dockerfile, when running "RUN bundle install", start installing dependencies until error is shown:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. #10
34.20 #10 34.20 current directory: /usr/local/bundle/gems/tiny_tds-2.1.5/ext/tiny_tds #10 34.20
/usr/local/bin/ruby -I /usr/local/lib/ruby/3.0.0 -r #10 34.20
./siteconf20220804-7-s3hvms.rb extconf.rb #10 34.20 looking for
freetds headers in the following directories: #10 34.20 -
/opt/local/include #10 34.20 - /opt/local/include/freetds #10 34.20 -
/usr/local/include #10 34.20 - /usr/local/include/freetds #10 34.20
looking for freetds library in the following directories: #10 34.20 -
/opt/local/lib #10 34.20 - /opt/local/lib/freetds #10 34.20 -
/usr/local/lib #10 34.20 - /usr/local/lib/freetds
Normally this issue is solved installing linux distribution headers files that is using, but in this case, I am not know how do it.
Dockerfile is this:
FROM ruby:3.0
## throw errors if Gemfile has been modified since Gemfile.lock
RUN bundle config --global frozen 1
WORKDIR /usr/src/app
COPY Gemfile Gemfile.lock ./
RUN gem i bundler
RUN bundle install
COPY . .
CMD ["rails c"]
I tried adding this to Dockerfile, but another error was shown:
RUN apt-get install ruby-dev
Thank you very much in advance to whoever can help me.
Try building on the 3.0-buster image because I think that comes with additional packages. More info here: https://hub.docker.com/_/ruby
I run RUN apt-get install ruby-dev in Dockerfile and this issue is the same to you.
I change to bellow. Beside you can add other lib such as nodejs postgresql-client ... I have consulted here https://docs.docker.com/samples/rails/
RUN apt-get update -qq && apt-get install -yq --no-install-recommends \
libpq-dev \
ruby-dev
or
RUN apt-get update -qq && apt-get install -y ruby-dev
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I have a simple Dockerfile using centos:latest which fails to find pdns using yum. This is running on Windows host.
$ docker --version
Docker version 20.10.8, build 3967b7d
Dockerfile_dns
FROM centos:latest
RUN yum update -y
RUN yum install -y epel-release pdns pdns-tools pdns-backend-postgresql pdns-backend-sqlite pdns-recursor net-tools bind-utils jq
Using command
$ docker build -t dns_img -f Dockerfile_dns .
#5 [2/3] RUN yum update -y
#5 sha256:103582845ea3b4ba6361ca1a570ed91dbb7ffbdb7bd1b67e3dc21635f2dfc8da
#5 CACHED
#6 [3/3] RUN yum install -y epel-release pdns pdns-tools pdns-backend-postgresql pdns-backend-sqlite pdns-recursor net-tools bind-utils jq
#6 sha256:6639667b2dcec34132dc4bfb88fe520d625f4ab8de649b631344017f22fbd2d7
#6 2.419 Last metadata expiration check: 0:16:22 ago on Fri Sep 24 16:21:33 2021.
#6 2.788 No match for argument: pdns
#6 2.792 No match for argument: pdns-tools
#6 2.796 No match for argument: pdns-backend-postgresql
#6 2.800 No match for argument: pdns-backend-sqlite
#6 2.804 No match for argument: pdns-recursor
#6 2.817 Error: Unable to find a match: pdns pdns-tools pdns-backend-postgresql pdns-backend-sqlite pdns-recursor
#6 ERROR: executor failed running [/bin/sh -c yum install -y epel-release pdns pdns-tools pdns-backend-postgresql pdns-backend-sqlite pdns-recursor net-tools bind-utils jq]: exit code: 1
I found some references to using a specific centos version, but that didn't help either.
That's because you don't have those dependencies in the repositories you have installed.
install this repo and you'll have the packages you need:
RUN yum install epel-release
After you can install your packages:
RUN yum install -y pdns pdns-tools pdns-backend-postgresql pdns-backend-sqlite pdns-recursor net-tools bind-utils jq
Installing the repo and the dependencies only it holds can't be done because yum executes the installation in one take instead of one after the other like python's pip for example
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 messed up my docker install on WSL Linux (Ubuntu 16.04.5 LTS). I have tried uninstalling it but it refuses to budge. Here are issues:
First checking if docker exists:
$ dpkg -l | grep -i docker
pFR docker-ce 5:18.09.4~3-0~ubuntu-xenial amd64 Docker: the open-source application container engine
Trying to remove docker-ce:
$ sudo apt-get purge -y docker-ce
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
docker-ce*
0 upgraded, 0 newly installed, 1 to remove and 146 not upgraded.
1 not fully installed or removed.
After this operation, 85.4 MB disk space will be freed.
dpkg: error processing package docker-ce (--purge):
package is in a very bad inconsistent state; you should
reinstall it before attempting a removal
Errors were encountered while processing:
docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)
And the coup de grĂ¢ce - trying to install any new program:
$ sudo apt-get install sysvbanner
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
docker-ce : Depends: docker-ce-cli but it is not going to be installed
Depends: containerd.io (>= 1.2.2-3) but it is not going to be installed
Recommends: aufs-tools but it is not going to be installed
Recommends: cgroupfs-mount but it is not going to be installed or
cgroup-lite but it is not going to be installed
Recommends: pigz but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
And trying to fix the install with apt-get -f install as recommended:
$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
containerd.io docker-ce-cli
The following NEW packages will be installed:
containerd.io docker-ce-cli
0 upgraded, 2 newly installed, 0 to remove and 146 not upgraded.
1 not fully installed or removed.
Need to get 0 B/50.3 MB of archives.
After this operation, 157 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package docker-ce-cli.
(Reading database ... 69776 files and directories currently installed.)
Preparing to unpack .../docker-ce-cli_5%3a18.09.4~3-0~ubuntu-xenial_amd64.deb ...
Unpacking docker-ce-cli (5:18.09.4~3-0~ubuntu-xenial) ...
Selecting previously unselected package containerd.io.
Preparing to unpack .../containerd.io_1.2.5-1_amd64.deb ...
Unpacking containerd.io (1.2.5-1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up docker-ce-cli (5:18.09.4~3-0~ubuntu-xenial) ...
Setting up containerd.io (1.2.5-1) ...
dpkg: error processing package docker-ce (--configure):
package is in a very bad inconsistent state; you should
reinstall it before attempting configuration
Errors were encountered while processing:
docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)
Pls. halp. If I maybe so informal.
I solved the problem with following commands:
sudo apt-get install docker-ce
sudo apt-get purge docker docker.io docker-ce
sudo apt autoremove
then I can install new programs:
sudo apt-get install php -y
Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 months ago.
Improve this question
I have observed a problem where apt-get install will fail within a container where:
the package is already installed and,
sudo is not used.
This can be recreated by creating a simple container, e.g.
docker run -it ubuntu:latest /bin/bash
Within the container, run the following:
apt-get install software-properties-common
apt-get install software-properties-common
The second time, this will fail with a "Killed" message. If you then prepend the statement with sudo it will complete successfully:
sudo apt-get install software-properties-common
If the user within the container is root, why is sudo required to reinstall an existing package? I do not believe this is related to the AUFS file system as prepending with sudo will complete.
This is using docker 1.10 and an Ubuntu image.
The main point is the use of sudo
It doesn't fail on Debian 11:
# docker run -it ubuntu:latest /bin/bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
00f50047d606: Pull complete
Digest: sha256:20fa2d7bb4de7723f542be5923b06c4d704370f0390e4ae9e1c833c8785644c1
Status: Downloaded newer image for ubuntu:latest
# apt-get update
Hit:1 http://ports.ubuntu.com/ubuntu-ports jammy InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease
Reading package lists... Done
# apt-get install software-properties-common
Reading package lists... Done
...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Processing triggers for dbus (1.12.20-2ubuntu4) ...
# apt-get install software-properties-common
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
software-properties-common is already the newest version (0.99.22.3).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
There may be something corrupt on your system. If running these don't help, you may need to reinstall:
apt-get update
apt-get upgrade
You need to install sudo package by following commands.
apt update && apt upgrade
apt install sudo