I am trying to install apt-utils on Docker because when I was just doing apt-get update, I was getting the error: debconf: delaying package configuration, since apt-utils is not installed. So I added a line to install apt-utils (along with curl):
RUN apt-get update && apt-get install -y apt-utils && apt-get install -y curl
But, I am still getting that error leading me to believe that my command didn't work. Below is my output when I try to build the image.
Step 5/12 : RUN apt-get update && apt-get install -y apt-utils && apt-get install -y curl
---> Running in 6e6565ff01bd
Get:1 http://security.debian.org jessie/updates InRelease [94.4 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://deb.debian.org jessie-updates InRelease [145 kB]
Get:3 http://deb.debian.org jessie Release.gpg [2420 B]
Get:4 http://deb.debian.org jessie Release [148 kB]
Get:5 http://security.debian.org jessie/updates/main amd64 Packages [624 kB]
Get:6 http://deb.debian.org jessie-updates/main amd64 Packages [23.0 kB]
Get:7 http://deb.debian.org jessie/main amd64 Packages [9098 kB]
Fetched 10.1 MB in 6s (1541 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
libapt-inst1.5
The following NEW packages will be installed:
apt-utils libapt-inst1.5
0 upgraded, 2 newly installed, 0 to remove and 24 not upgraded.
Need to get 537 kB of archives.
After this operation, 1333 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian/ jessie/main libapt-inst1.5 amd64 1.0.9.8.4 [169 kB]
Get:2 http://deb.debian.org/debian/ jessie/main apt-utils amd64 1.0.9.8.4 [368 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 537 kB in 0s (557 kB/s)
Selecting previously unselected package libapt-inst1.5:amd64.
(Reading database ... 21676 files and directories currently installed.)
Preparing to unpack .../libapt-inst1.5_1.0.9.8.4_amd64.deb ...
Unpacking libapt-inst1.5:amd64 (1.0.9.8.4) ...
Selecting previously unselected package apt-utils.
Preparing to unpack .../apt-utils_1.0.9.8.4_amd64.deb ...
Unpacking apt-utils (1.0.9.8.4) ...
Setting up libapt-inst1.5:amd64 (1.0.9.8.4) ...
Setting up apt-utils (1.0.9.8.4) ...
Processing triggers for libc-bin (2.19-18+deb8u10) ...
Reading package lists...
Building dependency tree...
Reading state information...
curl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 24 not upgraded.
Removing intermediate container 6e6565ff01bd
---> f65e29c6a6b9
Step 6/12 : RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
---> Running in f5764ba56103
Detected operating system as debian/8.
Checking for curl...
Detected curl...
Checking for gpg...
Detected gpg...
Running apt-get update... done.
Installing debian-archive-keyring which is needed for installing
apt-transport-https on many Debian systems.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/github_git-lfs.list...done.
Importing packagecloud gpg key... done.
Running apt-get update... done.
The repository is setup! You can now install packages.
Removing intermediate container f5764ba56103
---> a4e64687ab73
What is causing this and how can I fix it?
This is not actually an error and it is safe to ignore it. I have built a large number of container images without ever having apt-utils on any of them and regardless of this warning message, all package installs go through and work normally.
Anyway, if you want to have apt-utils - install it. It will give you this warning once and then it will disappear for future invocations of apt-get (as you can see in your own log, curl got installed without that message).
NOTE if you install apt-utils, you will get other warnings (because now the installer can run interactive config and will attempt that and fail). To suppress those and have packages that have interactive config with their defaults, run apt-get like this
DEBIAN_FRONTEND=noninteractive apt-get install -y pkgs....
After searching over the Internet, I have found some alternatives worth to be mentioned, instead of every time putting DEBIAN_FRONTEND=noninteractive in front of apt-get install -y {your-pkgs}:
Alternative 1: ARG DEBIAN_FRONTEND=noninteractive
Important: According to the feedbacks alternative 2 & 3 work for most of you, while alternative 1 does not. This is why this alternative is crossed out, but is kept for the sake of traceability & completeness.
The ARG instruction defines a variable that users can pass at
build-time to the builder with the docker build command using the
--build-arg = flag. (Reference: [6])
Solution characteristics:
ARG directive is set only during the build
The option 'noninteractive' is set as default value for the build-time only.
Since it is an argument, it can be changed by passing another value for this argument with e.g. docker build --build-arg DEBIAN_FRONTEND=newt
Example:
ARG DEBIAN_FRONTEND=noninteractive
...
RUN apt-get -yq install {your-pkgs}
Alternative 2: On-the-fly
It is the solution from Leo K.
Solution characteristics:
It can be set where is it needed. So a good fine-grained solution.
It can be set in a different value in a specific command, so it is not globally set.
The scope is the RUN and won't affect other directives.
Example:
RUN DEBIAN_FRONTEND=noninteractive apt-get -yq install {your-pkgs}
Alternative 3: ENV DEBIAN_FRONTEND=noninteractive
Setting ENV DEBIAN_FRONTEND noninteractive would also be an alternative but it is highly discouraged.
Another way would be to set at the beginning and unset it at the end of the Dockerfile.
Solution characteristics:
ENV directive will persists the environment variable after the build (not recommended), furthermore
It can be error prone if you forget to set it back to the default value.
Because it is set with ENV, it will be inherited by all images and containes built from the image, effectively changing their behaviour. (As mentioned in [1]) People using those images run into problems when installing software interactively, because installers do not show any dialog boxes.
The default frontend is DEBIAN_FRONTEND=newt (see [2], so it has to be set at the end of the file.
Example:
# Set for all apt-get install, must be at the very beginning of the Dockerfile.
ENV DEBIAN_FRONTEND noninteractive
...
# Non-interactive modes get set back.
ENV DEBIAN_FRONTEND newt
Alternative 4: RUN export DEBIAN_FRONTEND=noninteractive
Solution characteristics:
Quite similar to the alternative 2
By decoupling, the cohesion is suffering: why there is an export of this variable and to what it belongs to (apt-get).
The scope is the RUN and won't affect other directives.
Example:
# Set the frontend and then install your package
RUN export DEBIAN_FRONTEND=noninteractive && \
...
apt-get -yq install {your-pkgs} && \
...
More to read (references)
ENV DEBIAN_FRONTEND noninteractive
debconf: delaying package configuration, since apt-utils is not installed
point out that ENV DEBIAN_FRONTEND will persist, so its not recommended
Docker frequently asked questions (FAQ)
Debian Installer Parameters
Official documentation - ARG
Please run apt-get install apt-utils and voilà. Installed and no warnings.
This is an ongoing issue with no great solution... I went with this, it's sub-optimal, but it works:
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y apt-utils 2>&1 | \
grep -v "^debconf: delaying package configuration, since apt-utils.*"
Explanation:
grep -v reverse matches, lines starting with that will begone!
ARG is the new ENV if you don't need it at runtime.
We can then use apt-get all day without that error showing when building the image from scratch.
Proof that this works:
https://asciinema.org/a/WJCDEYcxCIy6EF7eXw0MAnK3c
Related
I am trying to create a docker image which includes an installed Firefox browser, using openjdk:11-slim or openjdk:11 as my base image.
This is a minimal reproducible example of my dockerfile:
FROM openjdk:11
RUN rm -rf /var/lib/apt/lists/* && \
apt-get update && apt-get install -y --no-install-recommends firefox
Here is the output of running docker build .:
$ docker build -t testing/simpleopenjdkfirefox .
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM openjdk:11
---> 1eec9f9fe101
Step 2/2 : RUN rm -rf /var/lib/apt/lists/* && apt-get update && apt-get install -y --no-install-recommends firefox
---> Running in da4e93ffe4a1
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [121 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [268 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7907 kB]
Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [7860 B]
Fetched 8422 kB in 2s (4114 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Package firefox 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 'firefox' has no installation candidate
The command '/bin/sh -c rm -rf /var/lib/apt/lists/* && apt-get update && apt-get install -y --no-install-recommends firefox' returned a non-zero code: 100
My reasons to believe that running apt-get install firefox should be possible are:
Firefox is visible as a package on both the Debian Packages (https://packages.debian.org/search?keywords=firefox) and the Ubuntu Packages (https://packages.ubuntu.com/search?keywords=firefox&searchon=names&suite=groovy§ion=all)
apt install firefox works on an Ubuntu machine (just CLI, no docker involved)
In the dockerfile, replacing firefox with wget works. This means that apt-get is working as intended, and something is specifically incompatible with firefox.
I've tried using the following base images:
openjdk:11-slim - my desired base image for what I'm working on
openjdk:11 - the full de facto openjdk image, should be the default working case
openjdk:11-buster - to see if Debian 10 would work
Why does the apt-get install fail in the docker build, but not in the Ubuntu CLI?
Is the issue Linux OS compatibility or something else?
The firefox package is only available under the Debian Unstable Repository (codename "Sid"). Debian Stable only has firefox-esr. To include the Sid repository in the package index update, you must add deb http://deb.debian.org/debian/ unstable main contrib non-free as a repository source for apt.
echo "deb http://deb.debian.org/debian/ unstable main contrib non-free" >> /etc/apt/sources.list.d/debian.list
apt-get update
apt-get install -y --no-install-recommends firefox
If the Sid repository does not have an up-to-date version of Firefox, the next best place to check are the Firefox PPAs (Personal Package Archive) operated by the Mozilla team themselves. PPAs are just repositories, and are added the exact same way as the Sid repository above:
Firefox PPA
Firefox Next PPA
For example,
sudo add-apt-repository ppa:mozillateam/firefox-next
sudo apt-get update
Due to to partly bad internet in our company we are having issues with building our containers constantly. Lets assume we have our php-fpm container which requires a lot of additional software and has about 60 build steps.
Now when doing docker-compose build --no-cache php-fpm the process quite often quits when e.g. doing apt-get update or installing a certain library.
Output is like this:
Step 29/56 : RUN apt-get update && apt-get -y --no-install-recommends install wkhtmltopdf
---> Running in 7ec583e71349
[...]
Err:1 http://deb.debian.org/debian buster/main amd64 libdouble-conversion1 amd64 3.1.0-3
Could not resolve 'deb.debian.org'
Err:2 http://deb.debian.org/debian buster/main amd64 libpcre2-16-0 amd64 10.32-5
Could not resolve 'deb.debian.org'
[.....]
ERROR: Service 'php-fpm' failed to build: The command '/bin/sh -c apt-get update && apt-get -y --no-install-recommends install wkhtmltopdf' returned a non-zero code: 100
So I wonder if there is a possibility to tell docker to try a step or even certain steps for like three times before quitting the build process?
I'm using the Visual Studio Code Remote - Containers extension with a customized DockerFile. It is based on https://github.com/microsoft/vscode-dev-containers/blob/master/containers/python-3/.devcontainer/Dockerfile but uses a different base image and doesn't try to pip install from requirements.txt.
When I build the container in vscode, with PostCreateCommand set to "python --version", the following errors appears in the dev containers terminal output:
Run: docker exec -w /workspaces/media-classifier dd5e552b4f113ecf74504cc6d3aed3ca1727b4a172645515392c4632b7c45b81 /bin/sh -c python --version
/bin/sh: 1: python: not found
postCreateCommand "python --version" failed.
I've tried using the same setting value for PostCreateCommand (python --version) using both the standard python3 container and the python3 anaconda container and they both successfully output the python version.
I've also tried setting PostCreateCommand to the following values, which all produce the same 'not found' error:
pip --version
conda --version
When the container has started, I'm successfully able to use python, pip and conda so they are definitely installed.
Dockerfile
FROM microsoft/cntk:2.6-cpu-python3.5
# Configure apt and install packages
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils 2>&1 \
#
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
&& apt-get -y install git procps lsb-release \
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
devcontainer.json
{
"name": "CNTK Python3.5",
"context": "..",
"dockerFile": "Dockerfile",
// Uncomment the next line if you want to publish any ports.
// "appPort": [],
// Uncomment the next line to run commands after the container is created.
"postCreateCommand": "python --version",
"extensions": [
"ms-python.python",
"neuron.neuron-ipe"
],
"settings": {
"python.pythonPath": "/opt/conda/bin/python",
"python.linting.pylintEnabled": true,
"python.linting.enabled": true
}
}
I'm expecting PostCreateCommand to execute successfully and output the python version installed in whichever anaconda environment is active at the time.
you are trying to run python when python3 is installed
try running
python3 --version
Since python3 is not a direct replacement for python v2, Debian based systems have not setup an automatic alias to point python to the python3 binaries. The recommended solution is to point all python v3 commands to python3. The workaround for applications that can't be easily updated is to setup an alias to point python to python3 anyway.
FROM microsoft/cntk:2.6-cpu-python3.5
# Configure apt and install packages
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils 2>&1 \
#
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
&& apt-get -y install \
git \
lsb-release \
procps \
python-is-python3 \
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
For more on this, see https://askubuntu.com/questions/320996/how-to-make-python-program-command-execute-python-3
From the comments, here's a similar example with a different base image, also fixed by installing python-is-python3:
$ docker run -it --rm --entrypoint bash mcr.microsoft.com/vscode/devcontainers/dotnet:0.202.1-6.0
Unable to find image 'mcr.microsoft.com/vscode/devcontainers/dotnet:0.202.1-6.0' locally
0.202.1-6.0: Pulling from vscode/devcontainers/dotnet
e5ae68f74026: Pull complete
a74667493539: Pull complete
3a0bffe13264: Pull complete
913bac4f4fc9: Pull complete
d2ea5cb43486: Pull complete
1414be57e953: Pull complete
868d7bfddf03: Pull complete
63ab446ca68f: Pull complete
1259b98fc625: Pull complete
802a0f1d31f7: Pull complete
094ecb532868: Pull complete
f643f7ed0620: Pull complete
Digest: sha256:d3bfb3e7c9ecfcb4472b59272e2f8857807667c0bd83fb1da935d28e9087e733
Status: Downloaded newer image for mcr.microsoft.com/vscode/devcontainers/dotnet:0.202.1-6.0
root ➜ / $ type python
bash: type: python: not found
root ➜ / $ type python3
python3 is /usr/bin/python3
root ➜ / $ apt-get update
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Get:2 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Get:4 https://dl.yarnpkg.com/debian stable InRelease [17.1 kB]
Get:5 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [102 kB]
Get:6 http://deb.debian.org/debian bullseye/contrib amd64 Packages [50.5 kB]
Get:7 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB]
Get:8 https://dl.yarnpkg.com/debian stable/main all Packages [10.5 kB]
Get:9 https://dl.yarnpkg.com/debian stable/main amd64 Packages [10.5 kB]
Get:10 http://deb.debian.org/debian bullseye/non-free amd64 Packages [93.8 kB]
Get:11 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2592 B]
Fetched 8670 kB in 3s (3246 kB/s)
Reading package lists... Done
root ➜ / $ apt-get install -y python-is-python3
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
python-is-python3
0 upgraded, 1 newly installed, 0 to remove and 13 not upgraded.
Need to get 2800 B of archives.
After this operation, 13.3 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 python-is-python3 all 3.9.2-1 [2800 B]
Fetched 2800 B in 0s (67.0 kB/s)
Selecting previously unselected package python-is-python3.
(Reading database ... 22711 files and directories currently installed.)
Preparing to unpack .../python-is-python3_3.9.2-1_all.deb ...
Unpacking python-is-python3 (3.9.2-1) ...
Setting up python-is-python3 (3.9.2-1) ...
Processing triggers for man-db (2.9.4-2) ...
root ➜ / $ type python
python is /usr/bin/python
I am trying to set up Scrapy docker env on my local by running this command
docker build -t scrapy .
I am getting below error
Get:20 http://archive.ubuntu.com/ubuntu precise Release [49.6 kB]
Get:21 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [2975 B]
Get:22 http://archive.ubuntu.com/ubuntu precise Release.gpg [198 B]
Ign:22 http://archive.ubuntu.com/ubuntu precise Release.gpg
Reading package lists...
W: GPG error: http://archive.ubuntu.com/ubuntu precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
E: The repository 'http://archive.ubuntu.com/ubuntu precise Release' is not signed.
The command '/bin/sh -c apt-get update' returned a non-zero code: 100
My Docker file looks like this
############################################################
# Dockerfile for a Scrapy development environment
# Based on Ubuntu Image
############################################################
FROM ubuntu
MAINTAINER NeuralFoundry <neuralfoundry.com>
RUN echo deb http://archive.ubuntu.com/ubuntu precise universe >> /etc/apt/sources.list
RUN apt-get update
## Python Family
RUN apt-get install -qy python python-dev python-distribute python-pip ipython
## Selenium
RUN apt-get install -qy firefox xvfb
RUN pip install selenium pyvirtualdisplay
## AWS Python SDK
RUN pip install boto3
## Scraping
RUN pip install beautifulsoup4 requests
RUN apt-get install -qy libffi-dev libxml2-dev libxslt-dev lib32z1-dev libssl-dev
## Scrapy
RUN pip install lxml scrapy scrapyjs
Any help would be appreciated. TIA
Your Dockerfile has an unqualified reference to FROM ubuntu. That will resolve to ubuntu:latest, which is currently the same as ubuntu:18.04. Ubuntu 18.04 is codenamed Bionic Beaver. Precise Penguin was 12.04. You're trying to point to a Precise Penguin repository from your Bionic Beaver ubuntu installation: RUN echo deb http://archive.ubuntu.com/ubuntu precise universe >> /etc/apt/sources.list.
It's breaking, presumably, because Ubuntu 18.04 doesn't have a key to verify the signature of the 12.04 repository. You should be consistent with your version throughout the image. Unfortunately, the oldest Docker image available looks like it's 14.04 (trusty). Is there a reason you wanted the precise repository specifically, or could you use a more modern version? Nothing jumps out at me from your Dockerfile as something that would break in 18.04. Pick the version you want and fix your FROM line to be FROM ubuntu:14.04 (or higher). Then remove that RUN echo deb ... line (assuming you don't acutally need the precise repository).
I have Dockerfile that I have used many times without an issue. Now I need to add some packages to it (ssmtp and sendmail) and when I add them the build fails with:
Sending build context to Docker daemon 645.3 MB
Sending build context to Docker daemon
Step 0 : FROM debian:jessie
---> 736e5442e772
Step 1 : MAINTAINER Larry Martell <larry.martell#foo.com>
---> Using cache
---> bd272aa26940
Step 2 : ENV HOME /opt/django/CAPgraph/
---> Using cache
---> 1c540ed91808
Step 3 : RUN echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/sources.list
---> Using cache
---> 8788d48e625d
Step 4 : RUN (apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential git python python-dev python-setuptools nginx sqlite3 supervisor mysql-server libmysqlclient-dev vim cron unzip software-properties-common python-software-properties openjdk-8-jre xvfb wkhtmltopdf ssmtp sendmail)
---> Running in 8986bca93fdb
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Get:2 http://security.debian.org jessie/updates/main amd64 Packages [436 kB]
Get:3 http://http.debian.net jessie-backports InRelease [166 kB]
Get:4 http://httpredir.debian.org jessie-updates InRelease [145 kB]
Get:5 http://http.debian.net jessie-backports/main amd64 Packages [1031 kB]
Get:6 http://httpredir.debian.org jessie-updates/main amd64 Packages [17.6 kB]
Ign http://httpredir.debian.org jessie InRelease
Get:7 http://httpredir.debian.org jessie Release.gpg [2373 B]
Get:8 http://httpredir.debian.org jessie Release [148 kB]
Get:9 http://httpredir.debian.org jessie/main amd64 Packages [9049 kB]
Fetched 11.1 MB in 9s (1211 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
sendmail : Depends: sendmail-bin but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
The command '/bin/sh -c (apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential git python python-dev python-setuptools nginx sqlite3 supervisor mysql-server libmysqlclient-dev vim cron unzip software-properties-common python-software-properties openjdk-8-jre xvfb wkhtmltopdf ssmtp sendmail)' returned a non-zero code: 100
If I add those packages to the list I then complains about others. What does this 'held broken packages' message mean and how do I fix it?
Here is the first part of my Dockerfile:
FROM debian:jessie ENV HOME /opt/django/CAPgraph/
RUN echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/sources.list
RUN (apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential git python python-dev python-setuptools nginx sqlite3 supervisor mysql-server libmysqlclient-dev vim cron unzip software-properties-common python-software-properties openjdk-8-jre xvfb wkhtmltopdf sendmail ssmtp)
I tried adding sendmail-bin and then it failed with:
The following packages have unmet dependencies:
sendmail-bin : Conflicts: mail-transport-agent
ssmtp : Conflicts: mail-transport-agent
E: Unable to correct problems, you have held broken packages.
I then added mail-transport-agent and it failed with:
Package mail-transport-agent is a virtual package provided by:
opensmtpd 5.7.3p2-1~bpo8+1
ssmtp 2.64-8
sendmail-bin 8.14.4-8+deb8u1
qmail-run 2.0.2+nmu1
postfix 2.11.3-1
nullmailer 1:1.13-1+deb8u1
msmtp-mta 1.4.32-2
masqmail 0.2.30-1
lsb-invalid-mta 4.1+Debian13+nmu1
exim4-daemon-light 4.84.2-2+deb8u3
exim4-daemon-heavy 4.84.2-2+deb8u3
esmtp-run 1.2-12
dma 0.9-1
courier-mta 0.73.1-1.6
citadel-mta 8.24-1+b3
E: Package 'mail-transport-agent' has no installation candidate
Debian is setup to only allow one mail transport agent, and your install command is trying to include two, ssmtp and sendmail/sendmail-bin. Since they conflict with each other, you'll need to remove one of these from your install command.
If the sendmail dependency is so your Python app can send email via the sendmail binary, just install ssmtp and configure it to use an external MTA.
Trying to run sendmail in a Docker container is not recommended