FreeBSD Docker install

FreeBSD 에서도 Docker 를 사용하실수 있습니다.

단, OS 올리고 내리고 정도만 정상적으로 됩니다. 

mariadb 볼륨 연결을 테스트 해보았지만 정상적으로 되지 않았습니다.

어디까지나 시험삼아 테스트 하시기 바랍니다.

zfs 파일시스템을 사용해야 하며 Test는 VM FreeBSD 11 로 진행 하였습니다.

Test VM은 OS 설치부터 zfs 로 진행을 하였습니다.

ufs 파일시스템을 사용하시면 별도로 파티션 추가후 zfs 파일시스템을 만드시고 작업 하시면 됩니다.



Docker 설치

root@bsd11:~ # pkg install docker-freebsd ca_root_nss


설치완료후 메세지

Message from docker-freebsd-20150625_1:
Docker requires a bit of setup before usage.

You will need to create a ZFS dataset on /usr/docker

# zfs create -o mountpoint=/usr/docker <zroot>/docker

And lastly enable the docker daemon
# sysrc -f /etc/rc.conf docker_enable="YES"
# service docker start


Starting the docker service will also add the following PF rule:

nat on ${iface} from to any -> (${iface})

Where $iface is the default NIC on the system, or the value
of $docker_nat_iface. This is for network connectivity to docker
containers in this early port. This should not be needed in future
versions of docker.
Message from ca_root_nss-3.32.1:
********************************* WARNING *********************************

FreeBSD does not, and can not warrant that the certification authorities
whose certificates are included in this package have in any way been
audited for trustworthiness or RFC 3647 compliance.

Assessment and verification of trust is the complete responsibility of the
system administrator.

*********************************** NOTE **********************************

This package installs symlinks to support root certificates discovery by
default for software that uses OpenSSL.

This enables SSL Certificate Verification by client software without manual

If you prefer to do this manually, replace the following symlinks with
either an empty file or your site-local certificate bundle.

  * /etc/ssl/cert.pem
  * /usr/local/etc/ssl/cert.pem
  * /usr/local/openssl/cert.pem

root@bsd11:~ #



docker 에서 사용할 zfs 파일시스템을 추가 합니다.

root@bsd11:~ # zfs create -o mountpoint=/usr/docker zroot/docker
root@bsd11:~ # df -h
Filesystem            Size    Used   Avail Capacity  Mounted on
zroot/ROOT/default     16G    788M     15G     5%    /
devfs                 1.0K    1.0K      0B   100%    /dev
zroot/tmp              15G     88K     15G     0%    /tmp
zroot/usr/home         15G    128K     15G     0%    /usr/home
zroot/usr/ports        16G    678M     15G     4%    /usr/ports
zroot/usr/src          16G    633M     15G     4%    /usr/src
zroot/var/audit        15G     88K     15G     0%    /var/audit
zroot/var/crash        15G     88K     15G     0%    /var/crash
zroot/var/log          15G    140K     15G     0%    /var/log
zroot/var/mail         15G     88K     15G     0%    /var/mail
zroot/var/tmp          15G     88K     15G     0%    /var/tmp
zroot                  15G     88K     15G     0%    /zroot
zroot/docker           15G     88K     15G     0%    /usr/docker


/etc/rc.conf 수정 및 docker service start

root@bsd11:~ # sysrc -f /etc/rc.conf docker_enable="YES"
docker_enable:  -> YES
root@bsd11:~ # service docker start
Starting docker...
root@bsd11:~ #


docker 명령어를 사용할 유저를 생성 합니다.

root@bsd11:~ # pw user add test -m -g wheel
root@bsd11:~ # passwd test
Changing local password for test
New Password:
Retype New Password:
root@bsd11:~ #


유저를 operator group 에 추가 합니다.

root@bsd11:~ # pw usermod test -G operator


test 유저로 작업

root@bsd11:~ # su - test
To see the IP addresses currently set on your active interfaces, type
"ifconfig -u".
                -- Dru <>


쉘을 변경 합니다. sh -> csh Shell 부분에서 변경하시면 됩니다.

password 는 User 패스워드를 입력하시면 됩니다.

$ chsh test
#Changing user information for test.
Shell: /bin/csh
Full Name: User &
Office Location:
Office Phone:
Home Phone:
Other information:


Docker Version 확인

test@bsd11:~ % docker version
Client version: 1.7.0-dev
Client API version: 1.19
Go version (client): go1.9
Git commit (client): 582db78
OS/Arch (client): freebsd/amd64
Server version: 1.7.0-dev
Server API version: 1.19
Go version (server): go1.9
Git commit (server): 582db78
OS/Arch (server): freebsd/amd64
test@bsd11:~ %


docker image search 

test@bsd11:~ % docker search centos
NAME                               DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
centos                             The official build of CentOS.                   3831      [OK]
ansible/centos7-ansible            Ansible on Centos7                              103                  [OK]
jdeathe/centos-ssh                 CentOS-6 6.9 x86_64 / CentOS-7 7.4.1708 x8...   90                   [OK]
tutum/centos                       Simple CentOS docker image with SSH access      33
imagine10255/centos6-lnmp-php56    centos6-lnmp-php56                              32                   [OK]
gluster/gluster-centos             Official GlusterFS Image [ CentOS-7 +  Glu...   21                   [OK]
kinogmt/centos-ssh                 CentOS with SSH                                 17                   [OK]
centos/mysql-57-centos7            MySQL 5.7 SQL database server                   15
openshift/base-centos7             A Centos7 derived base image for Source-To...   13
centos/python-35-centos7           Platform for building and running Python 3...   12
centos/php-56-centos7              Platform for building and running PHP 5.6 ...   10
openshift/jenkins-2-centos7        A Centos7 based Jenkins v2.x image for use...   6
openshift/mysql-55-centos7         DEPRECATED: A Centos7 based MySQL v5.5 ima...   6
darksheer/centos                   Base Centos Image -- Updated hourly             3                    [OK]
pivotaldata/centos-mingw           Using the mingw toolchain to cross-compile...   1
indigo/centos-maven                Vanilla CentOS 7 with Oracle Java Developm...   1                    [OK]
miko2u/centos6                     CentOS6 日本語環境                                   1                    [OK]
blacklabelops/centos               CentOS Base Image! Built and Updates Daily!     1                    [OK]
openshift/php-55-centos7           DEPRECATED: A Centos7 based PHP v5.5 image...   1
pivotaldata/centos-gpdb-dev        CentOS image for GPDB development. Tag nam...   1
smartentry/centos                  centos with smartentry                          0                    [OK]
openshift/wildfly-101-centos7      A Centos7 based WildFly v10.1 image for us...   0
pivotaldata/centos-gcc-toolchain   CentOS with a toolchain, but unaffiliated ...   0
pivotaldata/centos                 Base centos, freshened up a little with a ...   0
jameseckersall/sonarr-centos       Sonarr on CentOS 7                              0                    [OK]
test@bsd11:~ %


Docoker Test

test@bsd11:~ % docker run -it ubuntu bash
root@:/# cat /etc/lsb-release


error message 

볼륨연결 실패

test@bsd11:~ % docker run -d --name mysql -v mysql:/db -e MYSQL_ROOT_PASSWORD=wordpress -e MYSQL_DATABASE=wordpress -e MYSQL_USER=wordpress -e MYSQL_PASSWORD=wordpress mysql:5.7
Error response from daemon: cannot bind mount volume: mysql volume paths must be absolute.
test@bsd11:~ %


mariadb 구동 실패

test@bsd11:~ % docker run -d -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=true --name mariadb mariadb
test@bsd11:~ % docker  ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
test@bsd11:~ % docker ps -a
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS                      PORTS               NAMES
b58d150e823f        mariadb             "docker-entrypoint.s   3 seconds ago       Exited (1) 2 seconds ago                        mariadb     
b84ca391ae79        mysql               "docker-entrypoint.s   58 seconds ago      Exited (1) 58 seconds ago                       mysql       
test@bsd11:~ %



실험적으로 사용 하는것을 권장 합니다.


답글 남기기