Skip to content

Instantly share code, notes, and snippets.

@lox
Last active January 19, 2023 07:17
Show Gist options
  • Save lox/0f3d6bba94ff10fade5bea6809c8a3b5 to your computer and use it in GitHub Desktop.
Save lox/0f3d6bba94ff10fade5bea6809c8a3b5 to your computer and use it in GitHub Desktop.
Tweak flush and sync settings for Docker for Mac
#!/bin/bash
set -euo pipefail
# via https://github.com/docker/for-mac/issues/668#issuecomment-284028148
cd ~/Library/Containers/com.docker.docker/Data/database
git config --global user.useconfigonly false
git reset --hard > /dev/null
mkdir -p ./com.docker.driver.amd64-linux/disk
touch ./com.docker.driver.amd64-linux/disk/full-sync-on-flush
touch ./com.docker.driver.amd64-linux/disk/on-flush
echo
echo
echo "Current docker settings"
echo "-----------------------"
echo "full-sync-on-flush: $(cat ./com.docker.driver.amd64-linux/disk/full-sync-on-flush)"
echo "on-flush: $(cat ./com.docker.driver.amd64-linux/disk/on-flush)"
echo -n false > ./com.docker.driver.amd64-linux/disk/full-sync-on-flush
echo -n none > ./com.docker.driver.amd64-linux/disk/on-flush
git add ./com.docker.driver.amd64-linux/disk/full-sync-on-flush
git add ./com.docker.driver.amd64-linux/disk/on-flush
if ! git diff --cached --exit-code ; then
echo
echo "NEW docker settings"
echo "-----------------------"
echo "full-sync-on-flush: $(cat ./com.docker.driver.amd64-linux/disk/full-sync-on-flush)"
echo "on-flush: $(cat ./com.docker.driver.amd64-linux/disk/on-flush)"
echo
git commit -s -m "Disable flushing" > /dev/null
echo "Docker should restart by itself now."
else
echo
echo "No changes were made"
fi
@abbotto
Copy link

abbotto commented May 24, 2018

~/Library/Containers/com.docker.docker/Data/database/ is missing because it is no longer used.

@mityukov
Copy link

@abotto

Does it mean there is no way or no need to disable full sync on flush anymore?

What should the users of newest docker do to have MySQL to be at lease tolerable?…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment