How to run docker with experimental functions on U

2020-05-25 02:43发布

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 ?

3条回答
来,给爷笑一个
2楼-- · 2020-05-25 03:12

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", not true

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...).

查看更多
仙女界的扛把子
3楼-- · 2020-05-25 03:18

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

UPDATE

Instead of nano you can use this one-liner:

echo $'{\n    "experimental": true\n}' | sudo tee /etc/docker/daemon.json;
查看更多
迷人小祖宗
4楼-- · 2020-05-25 03:31

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
查看更多
登录 后发表回答