[Small story] I can't find it even though I apt search to install Python on ubuntu with Docker.

Premise

Pull official image nginx.

I want to install Python

I went into a container and searched for python, but ...

❯ docker container run -it nginx:latest bash
root@487042b15fe4:/# apt search python
Sorting... Done
Full Text Search... Done
libhogweed4/now 3.4.1-1 amd64 [installed,local]
  low level cryptographic library (public-key cryptos)

libnettle6/now 3.4.1-1 amd64 [installed,local]
  low level cryptographic library (symmetric and one-way cryptos)

Only this comes out, is that? It becomes.

solution

Update apt.

root@260aef3fab91:/# apt update
Get:1 http://cdn-fastly.deb.debian.org/debian buster InRelease [122 kB]
Get:2 http://security-cdn.debian.org/debian-security buster/updates InRelease [39.1 kB]
Get:3 http://cdn-fastly.deb.debian.org/debian buster-updates InRelease [49.3 kB]
Get:4 http://cdn-fastly.deb.debian.org/debian buster/main amd64 Packages [7899 kB]
Get:5 http://security-cdn.debian.org/debian-security buster/updates/main amd64 Packages [108 kB]
Get:6 http://cdn-fastly.deb.debian.org/debian buster-updates/main amd64 Packages [5792 B]
Fetched 8222 kB in 3s (2716 kB/s)                    
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.

Solution → w that came out

root@260aef3fab91:/# apt search python3
Sorting... Done
Full Text Search... Done
2to3/stable 3.7.3-1 all
  2to3 binary using python3

astro-python3/stable 2.0 all
  Python 3 packages for astronomy

bpython3/stable 0.17.1-1 all
  fancy interface to the Python 3 interpreter

cantor-backend-python3/stable 4:18.12.0-2 amd64
  Python3 backend for Cantor

cupp3/stable 0.0+20160624.git07f9b8-1 all
  generate dictionaries for attacks from personal data version for python3

flatlatex/stable 0.8-1 all
  Python3 LaTeX math converter to unicode text - binaries

freecad-python3/stable 0.18~pre1+dfsg1-5 amd64
  Extensible Open Source CAx program - Python 3 binaries

games-python3-dev/stable 3 all
  development of games in Python 3

gcc-python3-dbg-plugin/stable 0.17-2 amd64
  plugin for GCC to invoke Python scripts from inside the compiler

gcc-python3-plugin/stable 0.17-2 amd64
  plugin for GCC to invoke Python scripts from inside the compiler

gstreamer1.0-python3-dbg-plugin-loader/stable 1.14.4-1+b1 amd64
  GStreamer Loader for Python Plugin (Python 3, debug extensions)

gstreamer1.0-python3-plugin-loader/stable 1.14.4-1+b1 amd64
  GStreamer Loader for Python Plugin (Python 3)

hexchat-python3/stable 2.14.2-4 amd64
  Python 3 plugin for HexChat

humanfriendly/stable 4.18-1 all
  Helper command for the humanfriendly Python3 library

idle-python3.7/stable 3.7.3-2 all
  IDE for Python (v3.7) using Tkinter

ipython3/stable 5.8.0-1 all
  Enhanced interactive Python 3 shell

ipython3-qtconsole/stable 4.3.1-1 all
  transitional dummy package for python3-qtconsole

isympy3/stable 1.3-2 all
  Python3 shell for SymPy

kamailio-python3-modules/stable 5.2.1-1 amd64
  The app_python3 module for the Kamailio SIP server

libcasa-python3/stable 3.0.0-4 amd64
  CASA legacy Python 2 bindings

libcasa-python3-3/stable 3.0.0-4 amd64
  CASA Python bindings

libfreecad-python3-0.18/stable 0.18~pre1+dfsg1-5 amd64
  Extensible Open Source CAx program - Python 3 library files

libpython3-all-dbg/stable 3.7.3-1 amd64
  package depending on all supported Python 3 debugging packages

libpython3-all-dev/stable 3.7.3-1 amd64
  package depending on all supported Python 3 development packages

libpython3-dbg/stable 3.7.3-1 amd64
  debug build of the Python 3 Interpreter (version 3.7)

libpython3-dev/stable 3.7.3-1 amd64
  header files and a static library for Python (default)

libpython3-stdlib/stable 3.7.3-1 amd64
  interactive high-level object-oriented language (default python3 version)

libpython3.7/stable 3.7.3-2 amd64
  Shared Python runtime library (version 3.7)

libpython3.7-dbg/stable 3.7.3-2 amd64
  Debug Build of the Python Interpreter (version 3.7)

libpython3.7-dev/stable 3.7.3-2 amd64
  Header files and a static library for Python (v3.7)

libpython3.7-minimal/stable 3.7.3-2 amd64
  Minimal subset of the Python language (version 3.7)

libpython3.7-stdlib/stable 3.7.3-2 amd64
  Interactive high-level object-oriented language (standard library, version 3.7)

libpython3.7-testsuite/stable 3.7.3-2 all
  Testsuite for the Python standard library (v3.7)

libshiboken-py3-1.2v5/stable 1.2.2-5.1+b1 amd64
  CPython3 bindings generator for C++ libraries - shared library

libshiboken2-py3-5.11/stable 5.11.2-3 amd64
  CPython bindings generator for C++ libraries (Python3 shared library)

postgresql-11-python3-multicorn/stable 1.3.4-4 amd64
  multicorn extension for Postgres 11 to write FDWs with python3

postgresql-plpython3-11/stable,stable 11.5-1+deb10u1 amd64
  PL/Python 3 procedural language for PostgreSQL 11

py3status/stable 3.14-2 all
  extensible i3status wrapper written in Python (Python3 package)

pylama/stable 7.4.3-2 all
  code audit tool for Python in Python3

python-bx-tools/stable 0.8.2-1 all
  command line interface to python3-bx

python-cerberus-doc/stable 1.2-2 all
  Documentation for python3-cerberus

python-django-celery-beat-doc/stable 1.1.1-1 all
  Database-backed Periodic Tasks (Python3 version)

python-django-python3-ldap/stable 0.11.2-1 all
  Django LDAP user authentication backend (Python2 version)

python-mando-doc/stable 0.6.4-4 all
  command line argument parser for python3 (common documentation)

python-odf-doc/stable 1.4.0-1 all
  documentation and examples for python-odf and python3-odf

python-openslide-examples/stable 1.1.1-4 all
  Python examples for python-openslide and python3-openslide

python-requests-toolbelt-doc/stable 0.8.0-1 all
  Utility belt for python3-requests (documentation)

python-x2gobroker-doc/stable 0.0.4.1-1 all
  X2Go Session Broker (Python3 module documentation)

python3/stable 3.7.3-1 amd64
  interactive high-level object-oriented language (default python3 version)

python3-aalib/stable 0.3.2-3 all
  Python 3 interface to AAlib, an ASCII art library

python3-acme/stable 0.31.0-2 all
  ACME protocol library for Python 3

...(Since the dependency still continues, it is omitted below)

Installation.

root@260aef3fab91:/# apt install python3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  bzip2 file libmagic-mgc libmagic1 libmpdec2 libpython3-stdlib libpython3.7-minimal libpython3.7-stdlib libsqlite3-0 mime-support python3-minimal python3.7 python3.7-minimal xz-utils
Suggested packages:
  bzip2-doc python3-doc python3-tk python3-venv python3.7-venv python3.7-doc binutils binfmt-support
The following NEW packages will be installed:
  bzip2 file libmagic-mgc libmagic1 libmpdec2 libpython3-stdlib libpython3.7-minimal libpython3.7-stdlib libsqlite3-0 mime-support python3 python3-minimal python3.7 python3.7-minimal xz-utils
0 upgraded, 15 newly installed, 0 to remove and 0 not upgraded.
Need to get 5927 kB of archives.
After this operation, 31.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://security-cdn.debian.org/debian-security buster/updates/main amd64 libmagic-mgc amd64 1:5.35-4+deb10u1 [242 kB]
Get:2 http://security-cdn.debian.org/debian-security buster/updates/main amd64 libmagic1 amd64 1:5.35-4+deb10u1 [117 kB]
Get:3 http://cdn-fastly.deb.debian.org/debian buster/main amd64 libpython3.7-minimal amd64 3.7.3-2 [588 kB]
Get:4 http://cdn-fastly.deb.debian.org/debian buster/main amd64 python3.7-minimal amd64 3.7.3-2 [1736 kB]
Get:5 http://cdn-fastly.deb.debian.org/debian buster/main amd64 python3-minimal amd64 3.7.3-1 [36.6 kB]
Get:6 http://cdn-fastly.deb.debian.org/debian buster/main amd64 mime-support all 3.62 [37.2 kB]
Get:7 http://cdn-fastly.deb.debian.org/debian buster/main amd64 libmpdec2 amd64 2.4.2-2 [87.2 kB]
Get:8 http://cdn-fastly.deb.debian.org/debian buster/main amd64 libsqlite3-0 amd64 3.27.2-3 [641 kB]
Get:9 http://cdn-fastly.deb.debian.org/debian buster/main amd64 libpython3.7-stdlib amd64 3.7.3-2 [1732 kB]
Get:10 http://security-cdn.debian.org/debian-security buster/updates/main amd64 file amd64 1:5.35-4+deb10u1 [66.4 kB]
Get:11 http://cdn-fastly.deb.debian.org/debian buster/main amd64 python3.7 amd64 3.7.3-2 [330 kB]
Get:12 http://cdn-fastly.deb.debian.org/debian buster/main amd64 libpython3-stdlib amd64 3.7.3-1 [20.0 kB]
Get:13 http://cdn-fastly.deb.debian.org/debian buster/main amd64 python3 amd64 3.7.3-1 [61.5 kB]
Get:14 http://cdn-fastly.deb.debian.org/debian buster/main amd64 bzip2 amd64 1.0.6-9.2~deb10u1 [48.4 kB]                                                                                                                                                        
Get:15 http://cdn-fastly.deb.debian.org/debian buster/main amd64 xz-utils amd64 5.2.4-1 [183 kB]                                                                                                                                                                
Fetched 5927 kB in 11s (539 kB/s)                                                                                                                                                                                                                               
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libpython3.7-minimal:amd64.
(Reading database ... 7203 files and directories currently installed.)
Preparing to unpack .../libpython3.7-minimal_3.7.3-2_amd64.deb ...
Unpacking libpython3.7-minimal:amd64 (3.7.3-2) ...
Selecting previously unselected package python3.7-minimal.
Preparing to unpack .../python3.7-minimal_3.7.3-2_amd64.deb ...
Unpacking python3.7-minimal (3.7.3-2) ...
Setting up libpython3.7-minimal:amd64 (3.7.3-2) ...
Setting up python3.7-minimal (3.7.3-2) ...
Selecting previously unselected package python3-minimal.
(Reading database ... 7444 files and directories currently installed.)
Preparing to unpack .../0-python3-minimal_3.7.3-1_amd64.deb ...
Unpacking python3-minimal (3.7.3-1) ...
Selecting previously unselected package mime-support.
Preparing to unpack .../1-mime-support_3.62_all.deb ...
Unpacking mime-support (3.62) ...
Selecting previously unselected package libmpdec2:amd64.
Preparing to unpack .../2-libmpdec2_2.4.2-2_amd64.deb ...
Unpacking libmpdec2:amd64 (2.4.2-2) ...
Selecting previously unselected package libsqlite3-0:amd64.
Preparing to unpack .../3-libsqlite3-0_3.27.2-3_amd64.deb ...
Unpacking libsqlite3-0:amd64 (3.27.2-3) ...
Selecting previously unselected package libpython3.7-stdlib:amd64.
Preparing to unpack .../4-libpython3.7-stdlib_3.7.3-2_amd64.deb ...
Unpacking libpython3.7-stdlib:amd64 (3.7.3-2) ...
Selecting previously unselected package python3.7.
Preparing to unpack .../5-python3.7_3.7.3-2_amd64.deb ...
Unpacking python3.7 (3.7.3-2) ...
Selecting previously unselected package libpython3-stdlib:amd64.
Preparing to unpack .../6-libpython3-stdlib_3.7.3-1_amd64.deb ...
Unpacking libpython3-stdlib:amd64 (3.7.3-1) ...
Setting up python3-minimal (3.7.3-1) ...
Selecting previously unselected package python3.
(Reading database ... 7889 files and directories currently installed.)
Preparing to unpack .../0-python3_3.7.3-1_amd64.deb ...
Unpacking python3 (3.7.3-1) ...
Selecting previously unselected package bzip2.
Preparing to unpack .../1-bzip2_1.0.6-9.2~deb10u1_amd64.deb ...
Unpacking bzip2 (1.0.6-9.2~deb10u1) ...
Selecting previously unselected package libmagic-mgc.
Preparing to unpack .../2-libmagic-mgc_1%3a5.35-4+deb10u1_amd64.deb ...
Unpacking libmagic-mgc (1:5.35-4+deb10u1) ...
Selecting previously unselected package libmagic1:amd64.
Preparing to unpack .../3-libmagic1_1%3a5.35-4+deb10u1_amd64.deb ...
Unpacking libmagic1:amd64 (1:5.35-4+deb10u1) ...
Selecting previously unselected package file.
Preparing to unpack .../4-file_1%3a5.35-4+deb10u1_amd64.deb ...
Unpacking file (1:5.35-4+deb10u1) ...
Selecting previously unselected package xz-utils.
Preparing to unpack .../5-xz-utils_5.2.4-1_amd64.deb ...
Unpacking xz-utils (5.2.4-1) ...
Setting up mime-support (3.62) ...
Setting up libmagic-mgc (1:5.35-4+deb10u1) ...
Setting up libsqlite3-0:amd64 (3.27.2-3) ...
Setting up libmagic1:amd64 (1:5.35-4+deb10u1) ...
Setting up file (1:5.35-4+deb10u1) ...
Setting up bzip2 (1.0.6-9.2~deb10u1) ...
Setting up xz-utils (5.2.4-1) ...
update-alternatives: using /usr/bin/xz to provide /usr/bin/lzma (lzma) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/lzma.1.gz because associated file /usr/share/man/man1/xz.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/unlzma.1.gz because associated file /usr/share/man/man1/unxz.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/lzcat.1.gz because associated file /usr/share/man/man1/xzcat.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/lzmore.1.gz because associated file /usr/share/man/man1/xzmore.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/lzless.1.gz because associated file /usr/share/man/man1/xzless.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/lzdiff.1.gz because associated file /usr/share/man/man1/xzdiff.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/lzcmp.1.gz because associated file /usr/share/man/man1/xzcmp.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/lzgrep.1.gz because associated file /usr/share/man/man1/xzgrep.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/lzegrep.1.gz because associated file /usr/share/man/man1/xzegrep.1.gz (of link group lzma) doesn't exist
update-alternatives: warning: skip creation of /usr/share/man/man1/lzfgrep.1.gz because associated file /usr/share/man/man1/xzfgrep.1.gz (of link group lzma) doesn't exist
Setting up libmpdec2:amd64 (2.4.2-2) ...
Setting up libpython3.7-stdlib:amd64 (3.7.3-2) ...
Setting up libpython3-stdlib:amd64 (3.7.3-1) ...
Setting up python3.7 (3.7.3-2) ...
Setting up python3 (3.7.3-1) ...
running python rtupdate hooks for python3.7...
running python post-rtupdate hooks for python3.7...
Processing triggers for libc-bin (2.28-10) ...

It's done.

root@260aef3fab91:/# python3 --version
Python 3.7.3

That's why the Dockerfile looks like this

❯ vim Dockerfile-nginx 

FROM nginx:latest
  
COPY ./index.html /usr/share/nginx/html/
COPY ./server.conf /etc/nginx/conf.d/

RUN apt update && \
    apt install -y python3 && \
    python3 --version

the end

ubuntu I touched it for the first time. I'm sorry for being weak. Thank you for visiting.

Recommended Posts

[Small story] I can't find it even though I apt search to install Python on ubuntu with Docker.
I can't install Dask with pip on Ubuntu
I can't install python3 with pyenv-vertualenv
Steps to install Python environment on Ubuntu
How to install python3 with docker centos
I tried to install Docker on Windows 10 Home but it didn't work
I wanted to install Python 3.4.3 with Homebrew + pyenv
When I tried to create a project using Python on Docker with PyCharm, it didn't work, but it worked with Docker Compose.
Install selenium on Mac and try it with python
I made a Python3 environment on Ubuntu with direnv.
Troublesome story when using Python3 with VScode on ubuntu
I want to AWS Lambda with Python on Mac!
Install Python 3.3 on Ubuntu 12.04
Install Python 3.6 on Docker
I want to improve efficiency with Python even in an experimental system (1) Install Anaconda with Chocolatey
Put Ubuntu in Raspi, put Docker on it, and control GPIO with python from the container
I tried to find the entropy of the image with python
How to install Python2.7 python3.5 with pyenv (on RHEL5 CentOS5) (2016 Nov)
Install CaboCha in Ubuntu environment and call it with Python.
Install OpenCV on Ubuntu + python
I can't search with # google-map. ..
Install Docker on WSL Ubuntu 18.04
Life game with Python [I made it] (on the terminal & Tkinter)
How to install OpenCV on Cloud9 and run it in Python
What to do if you can't install pyaudio with pip #Python
I want to know if you install Python on Mac ・ Iroha
I want to do a full text search with elasticsearch + python
I tried to find out if ReDoS is possible with Python
I tried to summarize everyone's remarks on slack with wordcloud (Python)
Install lp_solve on Mac OS X and call it with python.
It's time to install DB with Docker! DB installation for beginners on Docker
Install Python 3.8 on Ubuntu 18.04 (OS standard)
Install Python 3.8 on Ubuntu 20.04 (OS standard)
[Small story] Get timestamp with Python
Unable to install Python with pyenv
I can't install scikit-learn in Python
Install Python 3.9 on Ubuntu 20.04 (OS standard?)
Install confluent-kafka for Python on Ubuntu
Install Python 2.7 on Ubuntu 20.04 (OS standard?)
Steps to install python3 on mac
I want to debug with Python
How to install Go on Ubuntu
[Python] I tried to visualize the night on the Galactic Railroad with WordCloud!
I want to do it with Python lambda Django, but I will stop
A story I was addicted to trying to install LightFM on Amazon Linux
I tried to draw a system configuration diagram with Diagrams on Docker
Use Python from Java with Jython. I was also addicted to it.
I set the environment variable with Docker and displayed it in Python
Environment maintenance made with Docker (I want to post-process GrADS in Python
I tried with the top 100 PyPI packages> I tried to graph the packages installed on Python
[Zaif] I tried to make it easy to trade virtual currencies with Python
Try to poke DB on IBM i with python + JDBC using JayDeBeApi
I have a private Python package but I want to install pipenv on GitHub Actions and build a Docker Image