News for hackers. Stuff that matters.
Re:Docker Performance Evaluation Across Operating Systems by brcmthrowaway on Tuesday August 27, 2024 @03:05PM (#41371543)
I jusst used Docker for the first time - I can't believe I didn't know about it before. I thought the only way to run Linux on macOS was using some sort of Virtualbox-esque solution.

I just don't like how the containers are ephemeral.. I want to use it like a VM.

Re:Docker Performance Evaluation Across Operating Systems by dijksterhuis on Tuesday August 27, 2024 @03:18PM (#41371710)
> I jusst used Docker for the first time

> I just don't like how the containers are ephemeral.. I want to use it like a VM

I suspect you’ve just pulled some images and run them locally?

If you want your own custom image to run whenever you want for whichever purpose, take a look into building your own containers with a Dockerfile

https://docs.docker.com/get-started/docker-concepts/building...

That gets you the base “everything I need is already installed when I start it”.

After that it’s volume mappings for accessing local data within the running container

https://docs.docker.com/engine/storage/volumes/

Re:Docker Performance Evaluation Across Operating Systems by brcmthrowaway on Tuesday August 27, 2024 @03:21PM (#41371755)
What if I used an bare image, installed some stuff and can't remember what all I did to get it in a usable state for my application.

I wish it could automatically create a Dockerfile for me.

Re:Docker Performance Evaluation Across Operating Systems by dijksterhuis on Tuesday August 27, 2024 @03:29PM (#41371865)
See ‘docker container commit’ [0]

> Create a new image from a [running] container's changes

You might then be able to run ‘docker image history’ [1] to get the changes, which you might be able to write into your own Dockerfile [2]

but I’ve never tested this workflow because the best practice is just to write a Dockerfile first

The tool (docker) was designed in a specific way, learn how to use the tool’s workflow instead of wishing for a different workflow and you’ll have a much easier time.

[0]: https://docs.docker.com/reference/cli/docker/container/commi...

[1]: https://docs.docker.com/reference/cli/docker/image/history/

[2]: can’t remember how docker tracks internal container file system changes and whether the history command will pick them up

Edit — see sibling comment https://news.ycombinator.com/item?id=41371867 — basically… learn to build a dockerfile (they’re very simple and easy once you know how).

Re:Docker Performance Evaluation Across Operating Systems by ptrrrrrrppr on Tuesday August 27, 2024 @03:29PM (#41371857)
``` tail .zsh_history > setup.sh echo COPY setup.sh >> Dockerfile echo RUN ./setup.sh >> Dockerfile ```
Re:Docker Performance Evaluation Across Operating Systems by wahnfrieden on Tuesday August 27, 2024 @03:29PM (#41371867)
you can but it's not recommended because it's basically impossible to audit changes made and is unrepeatable

https://stackoverflow.com/a/46917993/89373

Re:Docker Performance Evaluation Across Operating Systems by drgo on Tuesday August 27, 2024 @03:24PM (#41371795)
Re:Docker Performance Evaluation Across Operating Systems by maccard on Tuesday August 27, 2024 @03:15PM (#41371681)
You can use volumes for that.
Re:Docker Performance Evaluation Across Operating Systems by fock on Tuesday August 27, 2024 @05:45PM (#41373452)
just mount the whole root fs as a volume? or use bwrap or crun or runc to run your OCI bundle. Sadly the latter tools have some warts for this purpose...
Re:Docker Performance Evaluation Across Operating Systems by kcb on Tuesday August 27, 2024 @05:57PM (#41373575)
Containers aren't ephemeral unless you want by default though. Are you passing in --rm on run?
Re:Docker Performance Evaluation Across Operating Systems by cstrahan on Tuesday August 27, 2024 @05:58PM (#41373582)
> I thought the only way to run Linux on macOS was using some sort of Virtualbox-esque solution.

On macOS, Docker uses HyperKit (which is a hypervisor built on top of macOS's Hypervisor.framework) to run a Linux virtual machine behind the scenes, so your containers actually are running in a VM, even if you don't (usually) interact directly with that VM.