欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

mac 上安装与卸载docker

程序员文章站 2022-05-29 10:54:42
...

1.安装Docker:
    1.1 brew update
    1.2 brew install boot2docker
    1.3 boot2docker upgrade
    1.4 boot2docker init
    1.5 boot2docker up
    1.6设置ENV:

    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH=/Users/wangxigang/.boot2docker/certs/boot2docker-vm
    export DOCKER_TLS_VERIFY=1
    添加到 .bash_profile 或者 .zshrc, 之后关闭iterm或者source xxx

    ok,安装完毕
    $ docker pull ubuntu 试试
    
     由于pull官方的register hub可能速度比较慢:
     推荐docker.io加速器:
     https://dashboard.daocloud.io/mirror
     
     安装完docker之后,也可以安装个docker-compose工具:
     brew install docker-compose

    参考官方文档:https://docs.docker.com/installation/mac/
2.卸载docker:
     参考:https://github.com/boot2docker/osx-installer
     卸载脚本uninstall.sh:
#!/bin/bash

# Uninstall Script

if [ "$(which boot2docker)" == "" ]; then
    echo "boot2docker does not exist on your machine!"
    exit 1
fi

if [ "${USER}" != "root" ]; then
    echo "$0 must be run as root!"
    exit 2
fi

echo "Stopping boot2docker processes..."
boot2docker stop && boot2docker delete

echo "Removing boot2docker executable..."
rm -f /usr/local/bin/boot2docker

echo "Removing boot2docker ISO and socket files..."
rm -rf ~/.boot2docker
rm -rf /usr/local/share/boot2docker

echo "Removing boot2docker SSH keys..."
rm -f ~/.ssh/id_boot2docker*

echo "Removing boot2docker OSX files..."
rm -f /private/var/db/receipts/io.boot2docker.*
rm -f /private/var/db/receipts/io.boot2dockeriso.*

echo "Removing Docker executable..."
rm -f /usr/local/bin/docker

echo "All Done!"
 
相关标签: brew