I have following question:
How to run docker with experimental features on (like image squashing docker build --squash=true...
for reduce it size) on ubuntu 16.04 ?
I have following question:
How to run docker with experimental features on (like image squashing docker build --squash=true...
for reduce it size) on ubuntu 16.04 ?
To turn on experimental docker functions create following file by:
sudo nano /etc/docker/daemon.json
and add below content to it
{
"experimental": true
}
and save file (by CTRL+X and Enter ) and exit. In terminal type:
sudo service docker restart
To check that experimental funcions are ON, type in terminal:
docker version
And you should see Experimental: true
Instead of nano you can use this one-liner:
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
~/.docker/config.json
and the value is "enabled"
, not true
–
Electromagnetism sudo service docker restart
will shut down any docker containers running, just be careful –
Entozoon I tried everything here on a Ubuntu 18.04 VM on my mac--nothing worked. All over the interwebs said the same thing, but the one thing that finally got experimental turned on was @Michael Haren's tiny answer:
fyi- to enable this for the client, the config file to create is
~/.docker/config.json
and the value is"enabled"
, nottrue
which meant something like this for me:
$ mkdir ~/.docker
$ echo '{ "experimental": "enabled" }' > ~/.docker/config.json
$ sudo systemctl restart docker
$ docker version
...
Experimental: true
...
This should be a top-level answer. So, credit to them (except sweet internet karma points for me...).
If you only want to run it temporarily / without modifying files, you can export DOCKER_CLI_EXPERIMENTAL=enabled
. The below turns on experimental mode for your client.
$ docker version
Experimental: false
$ export DOCKER_CLI_EXPERIMENTAL=enabled
$ docker version
Experimental: true
Posting this to help those who are running docker on macOS
You will need to enable experimental on two files, one is client while another is docker engine
I suggest open the file manually instead of direct echo into the file as that file might have some other configuration and you might not want to overwrite them accidentally
For client, visit ~/.docker/config.json
, and add "experimental": "enabled"
on top level config as below
{
"experimental" : "enabled",
"auths" : {
"harbor.xxx.com" : {
}
},
"credsStore" : "desktop"
}
For Docker Engine, visit ~/.docker/daemon.json
and add "experimental": true
on top level config as below
{
"features": {
"buildkit": true
},
"experimental": true,
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
}
}
Do note that the "value" of experimental
is different between client and server.
Once done, restart the docker using command below
killall Docker && open /Applications/Docker.app
then verify the result
docker version
I think you can solve this on Linux using the systemctl
as described by https://mcmap.net/q/382038/-how-to-run-docker-with-experimental-functions-on-ubuntu-16-04 on this SO. However, first you need to edit the correct files... Here's the way to set it up in a MacOS if you were looking for similar answers.
ENABLED=true
or ENABLED=false
and this script will automagically turn it on or off, writing to the fileNOTE: You MUST have
jq
installed to execute and update in-place.
ENABLED=true; \
CONFIG=~/.docker/config.json; DAEMON=~/.docker/daemon.json ; \
cat <<< $(jq --argjson V ${ENABLED} '.experimental = $V' ${DAEMON}) > ${DAEMON} ; \
cat <<< $(jq --arg V $(if [ "${ENABLED}" = "true" ]; then echo "enabled"; else echo "disabled"; fi) '.experimental = $V' ${CONFIG}) > ${CONFIG} ; \
cat ~/.docker/config.json ; \
cat ~/.docker/daemon.json
{
"auths": {
"https://index.docker.io/v1/": {},
"registry.gitlab.com": {}
},
"credsStore": "desktop",
"experimental": "enabled",
"currentContext": "default"
}
{
"builder": {
"gc": {
"defaultKeepStorage": "20GB",
"enabled": true
}
},
"experimental": true,
"features": {
"buildkit": true
}
}
killall Docker && open /Applications/Docker.app
sudo sed -i 's/ExecStart=\/usr\/bin\/dockerd -H fd:\/\/ --containerd=\/run\/containerd\/containerd.sock/ExecStart=\/usr\/bin\/dockerd -H fd:\/\/ --containerd=\/run\/containerd\/containerd.sock --experimental/g' /lib/systemd/system/docker.service
sudo systemctl daemon-reload
sudo systemctl restart docker
© 2022 - 2024 — McMap. All rights reserved.