Dockerfile running from Mysql cannot access apt-get
Asked Answered
H

2

14

When I run docker-compose up to install our MySQL server, I get the following error:

RUN apt-get -y update && apt-get upgrade -y:
/bin/sh: apt-get: command not found

from the relevant dockerfile code:

FROM mysql:5.7

RUN apt-get -y update && apt-get upgrade -y

This used to work fine a few months ago for my coworkers.

Hypertension answered 12/7, 2022 at 3:14 Comment(0)
H
28

Apparently since Oracle bought MySQL in 2010, they have been converting everything over to their proprietary OS. In the last few months, they switched the default mysql package to Oracle OS from Debian.

See the packages here: https://hub.docker.com/_/mysql

You now need to specify the debian package like:

FROM mysql:5.7-debian

RUN apt-get -y update && apt-get upgrade -y
Hypertension answered 12/7, 2022 at 3:14 Comment(1)
You should mark this as the answer.Adversative
H
1

@ian answer is correct right now it is installed using Oracle OS. below are the sample image of docker 5.7

so basically oracle Linux Server is like Centos. You can use "Yum" command. Example: I want to install nano editor

yum update
yum install nano
Heehaw answered 29/7, 2023 at 12:55 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.