boot2docker实践@FreeBSD

boot2docker是专为Docker而设计的轻量极Linux发型包,解决Windows、OS X、FreeBSD不能安装Docker的问题。Boot2Docker完全运行于内存中,24M大小,启动仅5-6秒。Boot2Docker需要运行在VirtualBox中,同时意味着有VirtualBox就能运行Boot2Docker,所以FreeBSD下也可以使用Docker拉!

官网:GitHub - boot2docker/boot2docker: DEPRECATED; see https://github.com/boot2docker/boot2docker/pull/1408

 不过已经有3年多没有更新了。

在FreeBSD下安装使用步骤如下:

1 安装docker-machine

pkg install docker-machine

2 创建vitrual-box 虚拟主机myvm

docker-machine create --driver virtualbox myvm

输出:

docker-machine create --driver virtualbox myvm
Running pre-create checks...
Creating machine...
(myvm) Copying /home/xxxx/.docker/machine/cache/boot2docker.iso to /home/xxxx/.docker/machine/machines/myvm/boot2docker.iso...
(myvm) Creating VirtualBox VM...
(myvm) Creating SSH key...
(myvm) Starting the VM...
(myvm) Check network to re-create if needed...
(myvm) Found a new host-only adapter: "vboxnet14"
Error creating machine: Error in driver during machine creation: Error setting up host only network on machine start: /usr/local/bin/VBoxManage hostonlyif ipconfig vboxnet14 --ip 192.168.99.1 --netmask 255.255.255.0 failed:
VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not available)
VBoxManage: error: Context: "EnableStaticIPConfig(Bstr(pszIp).raw(), Bstr(pszNetmask).raw())" at line 242 of file VBoxManageHostonly.cpp
 这样一个docker的linux虚拟主机文件就创建好了,后面就可以启动这个虚拟主机。

3 启动虚拟主机myvm并进入虚拟主机

可以使用

sudo -i 进入root账户

passwd 修改root账户口令

passwd docker 修改docker的口令

注意,因为boot2docker不存储信息,每次启动后账户密码都会复位

尝试docker命令pull(失败)

但是安装后,docker pull test ,报错:Error response from daemon: pull access denied for test, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

这里就劝退我了

后来按照提示发现需要docker账户

准备注册docker账户 ,但是官网的注册页面无法打开...

百度搜索,考虑可能需要用国内镜像 

编辑文件: /etc/docker/daemon.json

{
    "registry-mirrors": [
        "https://dockerproxy.com",
        "https://mirror.baidubce.com",
        "https://docker.m.daocloud.io",
        "https://docker.nju.edu.cn",
        "https://docker.mirrors.sjtug.sjtu.edu.cn"
    ]
}

还是报错,先不管pull了。

docker pull和run成功的测试

先docker search hello 找测试,发现了testcontainers/helloworld ,于是进行测试:

docker pull testcontainers/helloworld 

docker run testcontainers/helloworld

哇,起来了呢! 

输出:

docker@boot2docker:~$ docker pull testcontainers/helloworld                             
Using default tag: latest
latest: Pulling from testcontainers/helloworld
Digest: sha256:4ee5a832ef6eee533df7224b80d4cceb9ab219599014f408d0b69690be94c396
Status: Image is up to date for testcontainers/helloworld:latest
docker.io/testcontainers/helloworld:latest
docker@boot2docker:~$ docker run testcontainers/helloworld                              
2024/04/26 14:49:47 DELAY_START_MSEC: 0
2024/04/26 14:49:47 Sleeping for 0 ms
2024/04/26 14:49:47 Starting server on port 8080
2024/04/26 14:49:47 Sleeping for 0 ms
2024/04/26 14:49:47 Starting server on port 8081
2024/04/26 14:49:47 Ready, listening on 8080 and 8081

测试成功,后面需要啥docker,都可以pull和run拉! 

相关推荐

  1. FreeBSD RISCV 在QEME中实践

    2024-04-26 23:40:02       33 阅读
  2. docker中安装paddle serving @FreeBSD(待续)

    2024-04-26 23:40:02       36 阅读
  3. docker实战2

    2024-04-26 23:40:02       40 阅读
  4. 2、趁热打铁,Docker实战

    2024-04-26 23:40:02       41 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-26 23:40:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-26 23:40:02       101 阅读
  3. 在Django里面运行非项目文件

    2024-04-26 23:40:02       82 阅读
  4. Python语言-面向对象

    2024-04-26 23:40:02       91 阅读

热门阅读

  1. nodejs

    nodejs

    2024-04-26 23:40:02      40 阅读
  2. 【动态规划】Leetcode 32. 最长有效括号【困难】

    2024-04-26 23:40:02       34 阅读
  3. 启动MySQL服务

    2024-04-26 23:40:02       38 阅读
  4. 38 事件

    2024-04-26 23:40:02       37 阅读
  5. 【MySQL面试题】经典面试题之“b+树”

    2024-04-26 23:40:02       40 阅读
  6. Nest.js项目小结2

    2024-04-26 23:40:02       35 阅读
  7. 机器学习模型保存和导出pmml文件(python代码)

    2024-04-26 23:40:02       38 阅读