HiveBrain v1.2.0
Get Started
← Back to all entries
snippetdockerMinor

How to move disk image in the command line?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
imagethedisklinemovehowcommand

Problem

As answered in this questions: Does Docker on MacOS support tmpfs? In order to run in memory docker, I need to move docker volumes to ramdisk. In macOS I can do it through docker preferences. However, I would like to write a script that could do it for me everytime I run docker on my machine. Is it possible to specify this setting using cmdline in mac?

Solution

Docker is running in a VM on MacOS. One of your options is to put the entire VM on a tmpfs. You could use this shell script to create and mount the ramdisk: https://gist.github.com/koshigoe/822455

Here is a guide for resizing the machine. https://gist.github.com/stefanfoulis/5bd226b25fa0d4baedc4803fc002829e

The trick is to stop docker first, then you can make changes and move the


~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2

wherever you like and symlink there from this location.

Context

StackExchange DevOps Q#4023, answer score: 2

Revisions (0)

No revisions yet.