2

I have those lines in a Dockerfile:

RUN apt-get update && apt-get install -y --no-install-recommends
  <list of packages>

I'm able to build a docker image via docker build -f Dockerfile ... in mac.

given that mac doesn't have apt-get, how does that work under the hood? Particularly, if I run a linux container in macOS and there is a python script with a dependency on some package installed with apt-get, how is that dependency resolved in the Mac environment?

govordovsky
  • 359
  • 2
  • 17
  • 1
    I'll do that. I'll keep my question for some time, and still encourage someone to answer to this basic question – govordovsky Sep 18 '20 at 17:00
  • The entire point of Docker is that you can run other OS containers inside the host OS. It's not the macOS that's running apt-get, it's the Linux container. – Guy Incognito Sep 18 '20 at 17:01
  • 1
    @GuyIncognito, 1. I have Dockerfile locally 2. I run `docker build` locally does that mean that `docker` have to do something with apt-get locally on my mac machine? – govordovsky Sep 18 '20 at 17:03
  • 2
    No. I don't know how to put it more clearly than in the previous comment. I'm just going to have to repeat what larsks said and tell you to read up on at least the basic concepts. – Guy Incognito Sep 18 '20 at 17:08
  • 2
    The guy has a valid question. Can the downvoters point to docker documentation which starts with Docker internal architecture and describes that it s a linux container? I had been using Docker for a while. Most documentation start with the benefits of containerization and how-to-do-x, but above question is more about internals. – Asad Iqbal Jan 28 '21 at 16:03
  • 1
    Here is a link which explain why Docker works best with Linux container out of the box, and Windows support was added later. MacOS support is still lacking. https://serverfault.com/questions/607443/can-mac-os-x-be-run-inside-docker – Asad Iqbal Jan 28 '21 at 16:11

1 Answers1

1

Maybe this post or this post can help you. There you can find the following lines:

If containers are possible because of the features available in the Linux kernel, then the obvious question is how do non-Linux systems run containers. Both Docker for Mac and Windows use Linux VMs to run the containers. Docker Toolbox used to run containers in Virtual Box VMs. But, the latest Docker uses Hyper-V in Windows and Hypervisor.framework in Mac.

flaxel
  • 4,173
  • 4
  • 17
  • 30