I want to be able to use the --squash
switch when building docker images as this shaves several MB of the result image.
This requires experimental features enabled for docker.
Executing a docker --version
confirms (as it should) experimental features to be off on hosted Azure Pipelines agents.
Server:
Engine:
Version: 18.03.1-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.5
Git commit: 9ee9f40
Built: Thu Apr 26 07:15:30 2018
OS/Arch: linux/amd64
Experimental: false
Linux agents are running
Kernel Version: 4.15.0-1022-azure
Operating System: Ubuntu 16.04.4 LTS
OSType: linux
Architecture: x86_64
I've tried altering /etc/systemd/system/docker.service.d/docker.conf
and /etc/docker/daemon.json
to start with/include experimental flags, but didn't succeed in enabling it.
docker.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// --experimental=tr
or
daemon.json
{
"experimental": true
}
But don't unsure if I can restart the daemon on a hosted agent.
Currently doing yaml builds invoking docker from bash, but didn't see anything around experimental in the web interface either.
If i spin up my own Ubuntu VM and host an agent on that, experimental works, but want to avoid cost and maintenance by using the hosted agents.
To enable experimental features on the Docker daemon, edit the daemon. json and set experimental to true . Experimental features provide early access to future product functionality.
Build service images (Required) Name of the Azure Service Connection. (Required) Name of the Azure Container Registry. (Required) Path to the primary Docker Compose file to use. (Optional) Additional Docker Compose files to be combined with the primary Docker Compose file.
In the Ubuntu Image you can simply restart the docker service, after the daemon.json
is updated. I use a script with two lines:
echo '{ "experimental": true }' | sudo tee /etc/docker/daemon.json
sudo service docker restart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With