The command sudo apt-get install docker-ce inside the container fails with the following error:
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
invoke-rc.d: initscript docker, action "start" failed.
â—Ź docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sun 2017-07-02 16:36:10 UTC; 13ms ago
Docs: https://docs.docker.com
Process: 679 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
Main PID: 679 (code=exited, status=1/FAILURE)
Tasks: 2
Memory: 4.0K
CPU: 181ms
CGroup: /system.slice/docker.service
Jul 02 16:36:10 dckr1 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Jul 02 16:36:10 dckr1 systemd[1]: Failed to start Docker Application Container Engine.
Jul 02 16:36:10 dckr1 systemd[1]: docker.service: Unit entered failed state.
Jul 02 16:36:10 dckr1 systemd[1]: docker.service: Failed with result 'exit-code'.
dpkg: error processing package docker-ce (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)
Restarting the container or the entire host does not change a thing. I can consistently reproduce this error. The host itself is a virtual machine (running on Hyper-V, in case this matters).
Thanks for any help on how to get Docker running in LXD.
Ok, so the problem is that the ip_tables kernel module isn’t loaded.
You can either just load that module on the host with modprobe, or you can add it to the container’s “linux.kernel_modules” config option so that LXD makes sure to have that module loaded before your container starts.
Cool. Note that not everyone will need this. LXD usually causes that module to be loaded already on the host as it uses it itself for the LXD managed bridges. It is however a problem that can arise for any number of kernel modules that container software may need and won’t be able to load themselves (for obvious security reasons).
Fixing the Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details. problem, for me this worked:
No changes to the docker systemd unit should be needed either with the latest Ubuntu docker.io package or with the latest upstream package. Both work fine unmodified here.
same happen here Ubuntu 16.04 server LTS LXD v 2.18
after add … linux.kernel_modules: ip_tables… in the config file …bumpbacata!!! done it work perfect.
JC