Lucas Kloss Teles
Lucas Kloss Teles

Reputation: 53

Unable to update python from 3.5.3 to 3.8.5 on docker container

I'm trying to update my python version that runs inside a docker container, but even when i try to update the packages with apt-get update or apt update and then running apt-get install python3.8 or apt install python3.8 i got the following error:

apt install python3.8
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3.8
E: Couldn't find any package by glob 'python3.8'
E: Couldn't find any package by regex 'python3.8'

I have already tried the answer on this link: How to Install python3.8 on debian 10?

More informations:

My docker-compose.yml

version: "3.3"
services:
  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USER}
      POSTGRES_DB: ${DB_DATABASE}
    volumes:
      - ./pgdata:/var/lib/postgres/data
    ports:
      - "${DB_PORT}:${DB_PORT}"
  web:
    image: node:12
    restart: always
    depends_on:
      - db
    ports:
      - 3000:3000
    volumes:
      - ./:/usr/app
    working_dir: /usr/app
    command: bash -c "apt-get update && apt-get install -y python3 wget && wget https://bootstrap.pypa.io/pip/3.5/get-pip.py && python3 get-pip.py && pip install opencv-contrib-python==4.1.2.30 && pip3 install numpy && pip3 install imutils && pip3 install pickle-mixin && pip3 install argparse && pip3 install requests && yarn && rm -rf get-pip.py && yarn start"
    environment:
      IMAGE_DIR_NAME: ${my_path}
      PYTHON_PATH: ${my_path}
      SCRYFALL_SCRIPT: ${my_path}
      DB_HOST: db
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "5"

How can i solve this problem?

Upvotes: 0

Views: 840

Answers (1)

Emerson Pedroso
Emerson Pedroso

Reputation: 191

I particularly suggest you to compile an image using multistage example alpine that will get smaller or even use a distroless with python3.8 and node12 is smaller and more secure container! but if you want a simpler solution have these source code available that works perfectly for your problem

here python and node image souce code https://github.com/nikolaik/docker-python-nodejs

from docker hub image

nikolaik/python-nodejs:python3.8-nodejs12-alpine

and here distroless images

https://github.com/GoogleContainerTools/distroless

Upvotes: 1

Related Questions