docker学习笔记-1

docker学习笔记一:安装##


mac安装docker###

docker官方文档上有这么一段话:

Because the Docker daemon uses Linux-specific kernel features, you can’t run Docker natively in OS X. Instead, you must use docker-machine to create and attach to a virtual machine (VM). This machine is a Linux VM that hosts Docker for you on your Mac

由于docker使用了特定的Linux内核功能,因此不能用原生的方式在os x上运行docker,只能使用docker-machine去创建docker并将它绑定到linux虚拟机上。

注意:只能在OS X 10.8以上的版本的mac上安装docker。

安装步骤###

  1. 如果你有VirtualBox正在运行,需要首先关闭正在运行的VirtualBox。

  2. 下载页面下载docker toolbox。

  3. 下载完毕,执行安装,安装完毕如下图:

  4. 执行最简单一个docker命令

    docker run hello-word // 这个命令会从dockerhub下载hello-world镜像
    

  5. 执行上图的中建议的命令

    docker run -it ubuntu bash // 会在本地安装ubuntu的镜像
    

    通过docker images 命令可以查看到刚才下载到本地的镜像


问题###

  1. 执行命令:
sudo docker commit -m "add nginx from ubuntu" -a "hwy1782" 60fff3da025c hwy1782/ubuntu-nginx:v1
报如下错误:
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

github上有相关的issue:

https://github.com/docker/kitematic/issues/1010


参考文献

  1. Docker简明教程
  2. Docker via Homebrew
  3. Mac OS X
原文地址:https://www.cnblogs.com/h9527/p/5532781.html