Docker isn't running on FreeBSD

Hi All, I have been debugging an issue on FreeBSD 11.3 which is mentioned here;
root@freebsd_DCC:~ # docker start hell0-world
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I have followed the guidelines given here https://wiki.freebsd.org/Docker#zroot. Docker installed successfully, But it isn't running.
If someone got it working, please post a fix.
 
Bastille might not be an alternative for people wanting "Docker" because they want to use stuff building upon Docker or they're just interested in using existing containers in Docker format. If this matches your usecase, just use Linux.

Jails probably aren't an "alternative" to Docker, but might be, depending on the usecase. A jail is just the technical implementation of a "container". Jails are *much* older than Docker, are robust, well tested and reasonably secure and definitely one of the better solutions in that area. Bastille builds upon these jails to add "Docker-like" management.

Therefore, if you're after some management tooling that is somewhat similar to Docker, give Bastille a go. If all you want is an isolated environment, use plain jails and be happy to have something that's likely to provide better security than Docker.
 
Please try out https://github.com/sadaszewski/focker/ . If pulling ready-made images is not your priority and you would rather just like to have a reliable image building tool with support for layers (which make it easier to do the development / debugging cycle as you don't have to re-build from scratch, just from the last layer), docker-compose style configuration orchestration, volumes and pretty much all the other great abstractions of Docker APART FROM the registry, you should like Focker.
 
Please try out https://github.com/sadaszewski/focker/ . If pulling ready-made images is not your priority and you would rather just like to have a reliable image building tool with support for layers (which make it easier to do the development / debugging cycle as you don't have to re-build from scratch, just from the last layer), docker-compose style configuration orchestration, volumes and pretty much all the other great abstractions of Docker APART FROM the registry, you should like Focker.
I tried to work this out.
After,
Installing the Python package from GitHub

The layout has created like this.

/focker
/focker/images

Jails and Volumes have not created.
 
I tried to work this out.
After,
Installing the Python package from GitHub

The layout has created like this.

/focker
/focker/images

Jails and Volumes have not created.

Hi Aruns, This sounds very strange. The code responsible for creating the initial layout looks like this:

Python:
def zfs_init():
    poolname = zfs_poolname()
    print('poolname:', poolname)
    for path in ['/focker', '/focker/images', '/focker/volumes', '/focker/jails']:
        if not os.path.exists(path):
            os.mkdir(path)
    os.chmod('/focker', 0o600)
    if not zfs_exists(poolname + '/focker'):
        zfs_run(['zfs', 'create', '-o', 'canmount=off', '-o', 'mountpoint=/focker', poolname + '/focker'])
    if not zfs_exists(poolname + '/focker/images'):
        zfs_run(['zfs', 'create', '-o', 'canmount=off', poolname + '/focker/images'])
    if not zfs_exists(poolname + '/focker/volumes'):
        zfs_run(['zfs', 'create', '-o', 'canmount=off', poolname + '/focker/volumes'])
    if not zfs_exists(poolname + '/focker/jails'):
        zfs_run(['zfs', 'create', '-o', 'canmount=off', poolname + '/focker/jails'])

and it is executed at the very beginning, every time you run any focker command. All those calls either are not executed because the required directories/datasets already exist OR they raise an exception if they fail. It is virtually impossible to just silently "not create /focker/volumes and /focker/jails". Have you received any error message? What is the output of `zfs list` and `find /focker`?
 
Docker has been one my big challenges for migrating from Linux to FreeBSD due to my job. I have tried different ways trying to run Docker in FreeBSD but its really unstable.

my current solution
Code:
1) Run Docker over a Virtual Machine
2) Use Virtualbox as hypervisor
3) Install docker-machine (including scripts bash-completion)
4) Up and running
FYI: Even MacOS and Windows10 needs a VM to run docker on it !! (It names is "LinuxKit VM", mor information in this link)
 
my future solution

Code:
1) Use native BSD hypervisor bhyve
2) Learning curve ;)

To be honest I would rather to learn "bhyve" that other alternatives like focker, etc.
Best
Diego
 
pkg search bhyve
pkg rdesc vm-bhyve
pkg install vm-bhyve

a vagrant "plugin" for bhyve is available, too. And user-friendly GUIs will be follow soon, I hope.
 
Last edited:
my future solution

Code:
1) Use native BSD hypervisor bhyve
2) Learning curve ;)

To be honest I would rather to learn "bhyve" that other alternatives like focker, etc.
Best
Diego

If you want to run Docker images (=Linux) why bother with a FreeBSD host in the first place. Focker delivers a native solution and works great.
 
Focker delivers a native solution and works great.
I will try "focker" solution and see if it supports all docker features as images, networks, secrets, configs, swarm, etc.
At the moment I am using docker-machine with virtualbox, and one dedicated VM(debian10-docker-server) for more complex environments.
 
I will try "focker" solution and see if it supports all docker features as images, networks, secrets, configs, swarm, etc.
At the moment I am using docker-machine with virtualbox, and one dedicated VM(debian10-docker-server) for more complex environments.
Focker currently supports images, volumes, containers and compositions. Network configuration is left to the user. To that end, in the composition files it supports the full range of options available in jail.conf. You could have a VNET-based or cloned loopback-based setup etc. but you have to code it yourself (perhaps in the prebuild/postbuild hooks of a composition?). Swarm, secrets and configs are not implemented. Secrets and configs are basically fancy mounts from the container perspective. I would say they are a bit superfluous. One can achieve analogous functionality using volumes. Swarm is another story and I do not have a good answer to that. Depending on your setup sysutils/nomad or sysutils/ansible could be used to orchestrate Focker containers across multiple machines. At the very least you could use Focker to build images for sysutils/nomad benefiting from the layered build support. If you have a particular software application in mind I would be willing to help you prepare the suitable Focker recipes.
 
Thanks for the information and let me show my current stack docker deployment in FreeBSD 12.1 :)

Testing simple docker images
Code:
1) docker-machine create --driver virtualbox test01
   Base on boot2docker.iso (small VM)
or
2) Deploy a minimal Debian10(docker) on Virtualbox (I created this box using packer )
   If I need to test more features  (its faster)

Testing docker swarm cluster
Code:
1) Deploy a docker Swarm cluster (1 manager + 1 worker) using vagrant on Virtualbox
2) vagrant boxes have been provision using packer too
3) vagrant plugins (networking, host, etc)

At the moment I have had no problems with my own "stack solution" (so far so good) but I would like to try bhyve instead virtualbox and see in which hypervisor the performance is better

PD: I think that it would be for another new post ;)
 
Thanks for the information and let me show my current stack docker deployment in FreeBSD 12.1 :)

Testing simple docker images
Code:
1) docker-machine create --driver virtualbox test01
   Base on boot2docker.iso (small VM)
or
2) Deploy a minimal Debian10(docker) on Virtualbox (I created this box using packer )
   If I need to test more features  (its faster)

Testing docker swarm cluster
Code:
1) Deploy a docker Swarm cluster (1 manager + 1 worker) using vagrant on Virtualbox
2) vagrant boxes have been provision using packer too
3) vagrant plugins (networking, host, etc)

At the moment I have had no problems with my own "stack solution" (so far so good) but I would like to try bhyve instead virtualbox and see in which hypervisor the performance is better

PD: I think that it would be for another new post ;)
Ok thanks for sharing your experiments. But which software would you like to actually run in your container(s)?
 
Ok thanks for sharing your experiments. But which software would you like to actually run in your container(s)?
Due to my job, I am deploying docker services using terraform in Docker swarms with TLS.
Software: jenkins, gocd, traefik, mongodb, nexus3, portainer,etc
Dockerized apps: written in python3 and java

Is a good bunch of technologies together :) (terraform, packer, vagrant, docker, virtualbox) an really easy to create a whole environment from scratch, tested and destroy them in seconds. When the tests are done I am able to deploy them in VMware Sphere, AWS, on-premises, etc.
 
Back
Top