Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docker [2016/01/20 11:59] – Link to app containers and OS level virtualization page, link to docker homepage TonyNarlockdocker [2022/10/21 01:44] (current) – Tweak runj description text KubilayKocak
Line 1: Line 1:
 ====== Docker on FreeBSD ====== ====== Docker on FreeBSD ======
  
-{{ docker/freebsd-docker_small.png|FreeBSD Docker}}+Docker is a popular container tool and ecosystem, comparable to [[Containers|FreeBSD Container & Jail tools]], used to simplify and speed-up the creation, deployment and management of isolated application environments.
  
-[[https://www.docker.com/|Docker]] is a popular application containment environment on GNU/Linux that is available on %%FreeBSD%% as of June, 2015. Docker on %%FreeBSD%% relies heavily on [[ZFS]], jail and the 64bit Linux compatibility layer that was introduced in June, 2015. Docker on %%FreeBSD%% is //genuine Docker// and retrieves containers from the official [[https://www.docker.io|docker.io]] repository. Consult the official [[https://docs.docker.com|Docker documentation]] and resources for further assistance.+  * [[https://www.docker.com/|Docker Homepage]]
  
-===== Status =====+Work is currently in-progress to develop a [[Containers#runj|FreeBSD Containers: Jail runtime implementation ("runj")]] and %%FreeBSD%% OCI Container Specification necessary to integrate %%FreeBSD%% support into the broader Docker ecosystem.
  
-Docker on %%FreeBSD%% is experimental. Limitations of the 64bit Linux compatibility subsystem will impact some Linux ABI containers and your testing and feedback is appreciated to help resolve any such issues.+runj is officially supported by containerd, supports Linux Jails and experimental network support, see [[Containers#runj|runj]] for more detail.
  
-The [[https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization|freebsd-virtualization mailing list]], as well as the IRC channels #freebsd-docker and #bhyve on chat.freenode.net are good places to participate.+====== Contact ======
  
-===== Requirements =====+  * [[https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization|freebsd-virtualization mailing list]] 
 +  * IRC: #freebsd-docker and #bhyve channels on Libera Chat.
  
-%%FreeBSD%% 11-CURRENT from July, 2015 or newer, specificially, [[https://svnweb.freebsd.org/base?view=revision&revision=283424|1100074, 11.0-CURRENT after adding preliminary support for x86-64 Linux binaries]].+====== Past Work ======
  
-===== Repository =====+A %%FreeBSD%% Docker port was originally made available in 2015, relying on [[ZFS]], [[Jails]] and 64bit support for the Linux compatibility layer introduced in June that year. A //genuine// Docker, it supported containers from the official [[https://www.docker.io|docker.io]] repository.
  
-[[https://github.com/kvasdopil/docker/tree/freebsd-compat|GitHub Repository]] of the Docker port+  * [[https://github.com/kvasdopil/docker|github: kvasdopil/docker]] (Original Docker %%FreeBSD%% Port) 
 +    * [[https://github.com/kvasdopil/docker/blob/freebsd-compat/FREEBSD-PORTING.md|Porting Notes: FREEBSD-PORTING.md]] 
 +  * [[https://svnweb.freebsd.org/ports/head/sysutils/docker-freebsd/|FreeBSD Port: sysutils/docker-freebsd]] (Deleted: Jan 2020)
  
-==== Creation of <zroot> using raw disk ==== +At last update, Docker (docker-freebsd port) was [[https://svnweb.freebsd.org/changeset/ports/494712|marked broken]] due to the following build error:
- +
-The following steps allocate a 4G ZFS root file system using a raw disk, it allows you to test quickly.+
  
 <code> <code>
-# kldload zfs +.gopath/src/github.com/docker/docker/pkg/system/mknod.go:12:22: cannot use dev 
-# dd if=/dev/zero of=/usr/local/dockerfs bs=1024K count=4000 +(type int) as type uint64 in argument to syscall.Mknod
-# zpool create -f zroot /usr/local/dockerfs +
-# zfs list +
-NAME    USED  AVAIL  REFER  MOUNTPOINT +
-zroot    55K  3.75G    19K  /zroot +
-# zpool list                                                                                                                                                                              +
-NAME    SIZE  ALLOC   FREE   FRAG  EXPANDSZ    CAP  DEDUP  HEALTH  ALTROOT +
-zroot  3.88G  11.8M  3.86G     0%         -     0%  1.00x  ONLINE  - +
-# zfs create -o mountpoint=/usr/docker zroot/docker+
 </code> </code>
 +
 +A [[https://reviews.freebsd.org/D21570|code review]] was opened in 2019 updating Docker to a later versions, but progress stalled.
 +
 +===== Requirements =====
 +
 +Limitations of the 64bit Linux compatibility subsystem will impact some Linux ABI containers and your testing and feedback is appreciated to help resolve any such issues.
 +
 +%%FreeBSD%% 11.1-RELEASE or newer, specifically any version after [[https://svnweb.freebsd.org/base?view=revision&revision=283424|preliminary support for x86-64 Linux binaries]] was added.
  
 ===== Installation and Use ===== ===== Installation and Use =====
Line 58: Line 59:
 You will need to create a ZFS dataset on /usr/docker You will need to create a ZFS dataset on /usr/docker
  
-# zfs create -o mountpoint=/usr/docker <zroot>/docker +# zfs create -o mountpoint=/usr/docker <zroot>/docker
  
 And lastly enable the docker daemon And lastly enable the docker daemon
Line 65: Line 66:
 </code> </code>
  
-Follow the above steps as instructed in the package message and the last ones can be supplanted with the non-permanent:+If you're not already using ZFS, you will need to [[#zroot|create a raw disk]], otherwise follow the above steps as instructed in the package message. 
 + 
 +==== Using Docker as a normal user ==== 
 + 
 +In order to use Docker as a non-root/non-super user account, your user must be in the ''%%operator%%'' group:
  
 <code> <code>
-# service docker onestart +# pw usermod <you> -G operator 
-Starting docker...+</code>
  
-# docker version+After changing your user's group membership, log out and back in. Once logged back in ''%%docker ps%%'' should be usable (for example) as a non-superuser. 
 + 
 +<code> 
 +% docker version
 Client version: 1.7.0-dev Client version: 1.7.0-dev
 Client API version: 1.19 Client API version: 1.19
Line 83: Line 91:
 OS/Arch (server): freebsd/amd64 OS/Arch (server): freebsd/amd64
  
-# docker search centos+% docker search centos
 NAME                      DESCRIPTION                     STARS   OFFICIAL   AUTOMATED NAME                      DESCRIPTION                     STARS   OFFICIAL   AUTOMATED
 centos                    The official build of CentOS.   1122    [OK] centos                    The official build of CentOS.   1122    [OK]
Line 89: Line 97:
 ... ...
  
-# docker pull centos+% docker pull centos
 latest: Pulling from centos latest: Pulling from centos
-f1b10cd84249: Pull complete  +f1b10cd84249: Pull complete 
-c852f6d61e65: Pull complete  +c852f6d61e65: Pull complete 
-7322fbe74aa5: Already exists +7322fbe74aa5: Already exists
 centos:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security. centos:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
 Digest: sha256:57554136c655abb33ecb7bb790b1db0279668d3763c3b81f31bc6c4e60e4a1f3 Digest: sha256:57554136c655abb33ecb7bb790b1db0279668d3763c3b81f31bc6c4e60e4a1f3
 Status: Downloaded newer image for centos:latest Status: Downloaded newer image for centos:latest
  
-# docker images+% docker images
 REPOSITORY        TAG      IMAGE ID       CREATED       VIRTUAL SIZE REPOSITORY        TAG      IMAGE ID       CREATED       VIRTUAL SIZE
 centos            latest   7322fbe74aa5   4 weeks ago   172.2 MB centos            latest   7322fbe74aa5   4 weeks ago   172.2 MB
  
-# docker run -t -i centos /bin/bash+% docker run -t -i centos /bin/bash
 [root@ /]# uname -a [root@ /]# uname -a
 Linux  2.6.32 FreeBSD 11.0-CURRENT #5 r285594: Tue Jul 14 23:30:11 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux Linux  2.6.32 FreeBSD 11.0-CURRENT #5 r285594: Tue Jul 14 23:30:11 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux
Line 110: Line 118:
  
 <code> <code>
-# docker ps+% docker ps
 CONTAINER ID  IMAGE   COMMAND      CREATED        STATUS        PORTS  NAMES CONTAINER ID  IMAGE   COMMAND      CREATED        STATUS        PORTS  NAMES
 920bc5fbb45c  centos  "/bin/bash"  9 seconds ago  Up 8 seconds         jolly_poincare 920bc5fbb45c  centos  "/bin/bash"  9 seconds ago  Up 8 seconds         jolly_poincare
Line 133: Line 141:
 devfs on /usr/docker/zfs/graph/d03bcd7082d9/dev (devfs, local, multilabel) devfs on /usr/docker/zfs/graph/d03bcd7082d9/dev (devfs, local, multilabel)
 ... ...
 +</code>
 +
 +==== Creation of a ZFS root using raw disk ====
 +
 +<callout type="warning">
 +These steps are only necessary if you're not already using ZFS.
 +</callout>
 +
 +The following steps allocate a 4G ZFS root file system using a raw disk, it allows you to test quickly.
 +
 +<code>
 +# kldload zfs
 +# dd if=/dev/zero of=/usr/local/dockerfs bs=1024K count=4000
 +# zpool create -f zroot /usr/local/dockerfs
 +# zfs list
 +NAME    USED  AVAIL  REFER  MOUNTPOINT
 +zroot    55K  3.75G    19K  /zroot
 +# zpool list
 +NAME    SIZE  ALLOC   FREE   FRAG  EXPANDSZ    CAP  DEDUP  HEALTH  ALTROOT
 +zroot  3.88G  11.8M  3.86G     0%         -     0%  1.00x  ONLINE  -
 +# zfs create -o mountpoint=/usr/docker zroot/docker
 </code> </code>
  
Line 189: Line 218:
  
 The "ca_root_nss" package is not installed. The "ca_root_nss" package is not installed.
- 
-<code> 
-docker run -t -i centos /bin/bash 
-jail: name cannot be numeric (unless it is the jid 
-</code> 
- 
-See [[https://github.com/kvasdopil/docker/pull/5|kvasdopil/docker Pull Request #5]], [[https://lists.freebsd.org/pipermail/freebsd-virtualization/2015-October/003890.html|freebsd-virtualization thread]] 
  
 ===== Related ===== ===== Related =====
Line 207: Line 229:
   * [[https://github.com/kvasdopil/docker/tree/freebsd-compat|GitHub of the FreeBSD docker port]]   * [[https://github.com/kvasdopil/docker/tree/freebsd-compat|GitHub of the FreeBSD docker port]]
   * [[https://github.com/3ofcoins/jetpack|Jetpack - FreeBSD Implementation of the Application Container Specification]]   * [[https://github.com/3ofcoins/jetpack|Jetpack - FreeBSD Implementation of the Application Container Specification]]
 +  * [[https://github.com/clovertrail/runc/tree/1501-SupportOnFreeBSD|FreeBSD runtime (based on Jail) for opencontainers/runc]]
  
 ==== FreeBSD on Docker Hub ==== ==== FreeBSD on Docker Hub ====
  
-  * https://hub.docker.com/r/lexaguskov/freebsd/ +  * [[https://hub.docker.com/r/lexaguskov/freebsd/|lexaguskov/freebsd: container image]] (hub.docker.com) 
-  * https://hub.docker.com/r/kazuyoshi/freebsd-minimal/ +  * [[https://hub.docker.com/r/kazuyoshi/freebsd-minimal/|kazuyoshi/freebsd-minimal: container image]] (hub.docker.com) 
-  * https://hub.docker.com/search/?q=freebsd&page=1&isAutomated=0&isOfficial=0&starCount=0&pullCount=0+  * [[https://hub.docker.com/search/?q=freebsd&page=1&isAutomated=0&isOfficial=0&starCount=0&pullCount=0|Docker Hub Search: freebsd]]
  
 ==== FreeBSD Docker on News and Article ==== ==== FreeBSD Docker on News and Article ====
Line 219: Line 242:
   * https://www.freebsdnews.com/2015/07/09/docker-freebsd/   * https://www.freebsdnews.com/2015/07/09/docker-freebsd/
   * https://news.ycombinator.com/item?id=9908195   * https://news.ycombinator.com/item?id=9908195
 +
 +----
 +
 +{{tag>Virtualization}}
 +{{tag>HowTo}}
  
  • docker.1453291156.txt.gz
  • Last modified: 2016/01/20 11:59
  • by TonyNarlock