【Linux】【Fabric】在ubuntu容器中安装Fabric环境

前言

  想在docker容器中安装docker部署fabric网络,有了以下尝试。

  尝试了centos镜像、redhat镜像都没解决docker容器中安装运行docker的问题,最后ubuntu成功了!

  虽然最后并没有使用,有兴趣的可以折腾下,哈哈哈。

安装

1.拉取ubuntu镜像并容器运行

# 拉取ubuntu镜像
docker pull ubuntu
# 以特权模式运行容器
docker run  --privileged --net host -dit -v /fabric:/opt --name fabric docker.io/ubuntu /bin/bash
# 进入容器
docker exec -it 25e25e bash

2.ubuntu容器中安装docker

# 更新源
apt-get update
# 安装以下包以使apt可以通过HTTPS使用存储库(repository):
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
# 添加Docker官方的GPG密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
# 使用下面的命令来设置stable存储库:
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# 再更新一下apt包索引:
apt-get update
# 安装最新版本的Docker CE:
apt-get install -y docker-ce
# 启动    
dockerd &

3.安装vim

apt-get install vim-gtk

4.安装curl

apt-get install openssl 
apt-get install libssl-dev
apt-get install curl

5.安装git

apt-get install git

6.安装python和pip

apt-get install -y python
apt-get install python-pip

7.安装go

curl -o -sSL https://storage.googleapis.com/golang/go1.11.linux-amd64.tar.gz
tar -C /usr/local -zxvf -sSL
vi ~/.profile

PATH=”$HOME/bin:$HOME/.local/bin:$PATH”
export PATH=$PATH:/usr/local/go/bin 
export GOROOT=/usr/local/go 
export GOPATH=$HOME/go 
export PATH=$PATH:$HOME/go/bin

source ~/.profile
cd ~
mkdir go

8.安装docker-compose(安装docker)

apt-get install \
    apt-transport-https \
    ca-certificates \
    gnupg-agent \
    software-properties-common
apt --fix-broken install
apt-get install -y iptables
dpkg -i docker-ce-cli_18.09.3_3-0_ubuntu-xenial_amd64.deb
dpkg -i containerd.io_1.2.4-1_amd64.deb
dpkg -i docker-ce_18.09.3_3-0_ubuntu-xenial_amd64.deb
curl -L https://github.com/docker/compose/releases/download/1.14.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
pip install docker-compose

9.安装nodejs

apt-get -y install wget
wget https://nodejs.org/dist/v9.8.0/node-v9.8.0-linux-x64.tar.xz
tar -C /usr/local -xvf node-v9.8.0-linux-x64.tar.xz
mv node-v9.8.0-linux-x64 node
ln -s /usr/local/node/bin/node /bin/node
ln -s /usr/local/node/bin/npm /bin/npm

10.测试

参考:https://www.cnblogs.com/jxd283465/p/11576555.html

posted @ 2019-09-27 15:57    阅读(854)  评论(0编辑  收藏  举报