On Kali

Preparation

Add Docker PGP key:

curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -

Configure Docker APT repository (Kali is based on Debian testing, which will be called buster upon release, and Docker now has support for it):

echo 'deb [arch=amd64] https://download.docker.com/linux/debian buster stable' > /etc/apt/sources.list.d/docker.list
apt-get update

Install Docker

If you had older versions of Docker installed, uninstall them:

apt-get remove docker docker-engine docker.io

Install Docker:

apt-get install docker-ce

Test

docker run hello-world

After installation, Docker service will be started, but not enabled (i.e. it will not be started automatically after reboot). To start it:

systemctl start docker

To start Docker automatically upon reboot (do it on your own risk!):

systemctl enable docker

Install Docker-Compose

Install

  1. Run this command to download the current stable release of Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  1. Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose

Note: If the command docker-compose fails after installation, check your path. You can also create a symbolic link to /usr/binor any other directory in your path.

sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Test

$ docker-compose --version
docker-compose version 1.24.1, build 1110ad01

On Win

win7、win8 等需要利用 docker toolbox 来安装,国内可以使用阿里云的镜像来下载,下载地址:http://mirrors.aliyun.com/docker-toolbox/windows/docker-toolbox/

官网下载的desktop安装包,无法直接在win7运行,可以在win10运行

docker toolbox 是一个工具集,它主要包含以下一些内容:

Docker CLI 客户端,用来运行docker引擎创建镜像和容器
Docker Machine. 可以让你在windows的命令行中运行docker引擎命令
Docker Compose. 用来运行docker-compose命令
Kitematic. 这是Docker的GUI版本
Docker QuickStart shell. 这是一个已经配置好Docker的命令行环境
Oracle VM Virtualbox. 虚拟机

注意:安装路径千万不要有中文!!!!

可以参考:Windows7下安装Docker、下载镜像和运行OpenTsdb容器

通过Git Bash(CMD)查看docker是否安装成功,输入docker-machine,出现版本等信息,安装能够运行,还会给出一些选项,包括machine安装路劲等

查看一些配置:

docker-machine config
Contents
  1. 1. On Kali
    1. 1.1. Preparation
    2. 1.2. Install Docker
      1. 1.2.1. Test
    3. 1.3. Install Docker-Compose
      1. 1.3.1. Install
      2. 1.3.2. Test
  2. 2. On Win