澳门威利斯人_威利斯人娱乐「手机版」

来自 威利斯人娱乐 2019-06-01 08:00 的文章
当前位置: 澳门威利斯人 > 威利斯人娱乐 > 正文

详解Docker源码编译安装,搭建即收即毁的临时邮

这段时间在尝试阅读Docker源码,一向想弄掌握docker关于namespace等的代码的在哪,以及怎么触发。但是在读书时意识一直找不到代码。。。想着依旧先源码安装下docker,然前面运维边打字与印刷些调节和测试音讯看看再说

源码官方网址:https://github.com/denghongcai/forsaken-mail
<h1>Installation</h1>
<h2>Docker安装(首推)</h2>

1、在Docker中安装景况(PHP、Nginx、MySQL、Redis、memcached、MongoDB)

安装此前


1、安装Docker

Docker源码需在docker容器编写翻译处境中编写翻译,所以先安装docker,安装境况依然是ubuntu1四.04

<h5>假若你网速较好的话,能够利用这种措施:</h5>
$~ docker pull malaohu/forsaken-mail //官方的镜像

二、查看安装软件版本

echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install docker-engine

图片 1

    #   docker -v  /  docker --version

    #   docker-compose -v

初始是使用apt-get install docker.io安装,但在编写翻译源码的时候会碰着A安德拉G错误。

拉取forsaken

三、在代码根目录新建docker安装境况所属目录:/data1/project/docker

安装

$~ docker run --name forsaken-mail -d -p 25:25 -p 3000:3000 malaohu/forsaken-mail

4、在 /data1/project/docker 新建 init.sh 脚本

docker的装置命令极粗略,纵然错误多数= =

图片 2

5、#   chmod a x init.sh

apt-get install make git golang
git clone https://git@github.com/docker/docker
cd docker
make build
make binary

运行.png

6、增加以下命令参预到  /data1/project/docker/init.sh 文件中保存(#####中的全数内容)

相遇的主题素材与减轻方案

View on http://yourip:3000

##########################################################################

Unknown instruction: ARG

图片 3

mkdir app

原因:

主界面.png

mkdir app/memcached

Docker Hub's automated build is still running Docker 1.8 and doesn't support ARG yet. There is a github issue tracking their upgrade to 1.9.

</br></br>

mkdir app/mysql

消除方案:选用设置新型的docker-engine方式

<h4>假诺你网速不太能够的话,请使用这种办法:</h4>
<h6>$~ git clone http://www.jianshu.com/p/34d3b4568059 </h6>
<h五>修改Dockerfile文件,改变天猫node源</h五>
<h6>$~ vim Dockerfile
一.在“apt-get clean"前面加上
”RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak &&
echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" >/etc/apt/sources.list &&
echo "deb http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list &&
echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >>/etc/apt/sources.list &&
echo "deb-src http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list“
拓展换源

mkdir app/nginx

docker daemon运营失利

二.在"npm install"前边加上 “-g cnpm --registry=https://registry.npm.taobao.org”
亦即 npm install -g cnpm --registry=https://registry.npm.taobao.org
</br>
保存
<h6>$~ docker build -t denghongcai/forsaken-mail . (不要遗忘".")

mkdir app/nginx/conf

复制代码 代码如下:

图片 4

mkdir app/php

FATA[0000] Error starting daemon: error initializing graphdriver: "/var/lib/docker" contains several valid graphdrivers: aufs, devicemapper; Please cleanup or explicitly choose storage driver (-s <DRIVER>)

docker安插过程

mkdir app/redis

缓慢解决方案:移除devicemap文件夹,如 mv /var/lib/docker/devicemapper/ .

图片 5

mkdir app/mongo

make build出错一

营造完结

mkdir db

Step 6 : RUN apt-get update && apt-get install -y apparmor apt-utils aufs-tools automake bash-completion binutils-mingw-w64 bsdmainutils btrfs-tools build-essential clang createrepo curl dpkg-sig gcc-mingw-w64 git iptables jq libapparmor-dev libcap-dev libltdl-dev libsqlite3-dev libsystemd-journal-dev libtool mercurial net-tools pkg-config python-dev python-mock python-pip python-websocket ubuntu-zfs xfsprogs libzfs-dev tar zip --no-install-recommends && pip install awscli==1.10.15
---> Running in 32ad02db3575
Get:1 http://ppa.launchpad.net trusty InRelease [15.5 kB]
Ign http://httpredir.debian.org jessie InRelease
Get:2 http://httpredir.debian.org jessie-updates InRelease [142 kB]
Get:3 http://security.debian.org jessie/updates InRelease [63.1 kB]
Get:4 http://httpredir.debian.org jessie Release.gpg [2373 B]
Get:5 http://ppa.launchpad.net trusty/main amd64 Packages [5150 B]
Get:6 http://httpredir.debian.org jessie-updates/main amd64 Packages [17.6 kB]
Get:7 http://httpredir.debian.org jessie Release [148 kB]
Get:8 http://httpredir.debian.org jessie/main amd64 Packages [9035 kB]
Get:9 http://security.debian.org jessie/updates/main amd64 Packages [232 kB]
Fetched 9662 kB in 19s (504 kB/s)
W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/main/binary-amd64/Packages Hash Sum mismatch

W: Failed to fetch http://security.debian.org/dists/jessie/updates/main/binary-amd64/Packages Hash Sum mismatch

E: Some index files failed to download. TheW: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/main/binary-amd64/Packages Hash Sum mismatch

$~ docker run --name forsaken-mail -d -p 25:25 -p 3000:3000 denghongcai/forsaken-mail</h6>
<h5>View On http://localhost:3000.</h5>

mkdir logs

看看是源的难点哎╮(╯▽╰)╭

图片 6

mkdir tools

同期是RUN指令,应该是dockerfile运转容器事后的源错误,so,看下docker/Dockerfile

主界面.png

mkdir tools/phpmyadmin

# ARG APT_MIRROR=httpredir.debian.org
RUN sed -i s/httpredir.debian.org/$APT_MIRROR/g /etc/apt/sources.list

</br>

mkdir tools/console

在此地修改了源~从网络再一次找个ftp.cn.debian.org,然则,。。。仍然错。。。

<h二>npm源码安装</h贰>
第一安装node.js意况,记得换源噢~能够参谋作者的稿子node.js安装和换Tmall源.
$~ git clone https://github.com/denghongcai/forsaken-mail.git
$~ npm install && npm start

mkdir web

行吗,那把那两句直接全部评释掉,用1陆3的debian源内容echo到容器里,实行

touch app/memcached/Dockerfile

复制代码 代码如下:

touch app/mysql/Dockerfile

RUN echo "deb jessie main non-free contribndeb jessie-updates main non-free contribndeb jessie-backports main non-free contribndeb-src jessie main non-free contribndeb-src jessie-updates main non-free contribndeb-src jessie-backports main non-free contribndeb jessie/updates main non-free contribndeb-src jessie/updates main non-free contrib" | tee /etc/apt/sources.list

touch app/nginx/Dockerfile

再施行make build,出现依赖问题,那就用aptitude吧

touch app/php/Dockerfile

RUN apt-get update && apt-get install -y aptitude
RUN aptitude install -y  

touch app/redis/Dockerfile

(同不日常候去掉–no-install-recommends那一行)

touch app/mongo/Dockerfile

make build出错二

touch tools/phpmyadmin/Dockerfile

Step 15 : RUN set -x   && export SECCOMP_PATH="$(mktemp -d)"   && curl -fsSL "https://github.com/seccomp/libseccomp/releases/download/v${SECCOMP_VERSION}/libseccomp-${SECCOMP_VERSION}.tar.gz"     | tar -xzC "$SECCOMP_PATH" --strip-components=1   && (     cd "$SECCOMP_PATH"     && ./configure --prefix=/usr/local     && make     && make install && ldconfig   )   && rm -rf "$SECCOMP_PATH"
 ---> Running in 4ad66d28289d
  mktemp -d
  export SECCOMP_PATH=/tmp/tmp.TWPYfciRjC
  curl -fsSL https://github.com/seccomp/libseccomp/releases/download/v2.3.1/libseccomp-2.3.1.tar.gz
  tar -xzC /tmp/tmp.TWPYfciRjC --strip-components=1
curl: (56) SSL read: error:00000000:lib(0):func(0):reason(0), errno 104

gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now

touch tools/console/Dockerfile

网络难点,网络有说先下载下来再用ADD加多进去,结果发掘高校网貌似访问那挺快的,连上vpn再实行就行了。。

touch app/nginx/conf/default.conf

make binary 出错

touch app/php/opcache-recommended.ini

复制代码 代码如下:

touch app/php/php.ini

ERROR:/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: fork/exec /usr/bin/gcc: cannot allocate memory

touch app/php/proxychains.conf

内部存款和储蓄器不足~增大虚拟机内部存款和储蓄器呗

touch app/php/proxychains-ng

安装结果

touch docker-compose.yaml

make build

curl -L -o ./app/php/redis.tar.gzhttps://github.com/phpredis/phpredis/archive/3.0.0.tar.gz

图片 7

curl -L -o ./app/php/memcached.tar.gz "https://codeload.github.com/php-memcached-dev/php-memcached/tar.gz/v3.0.2"

make binary

curl -L -o ./app/php/mongodb.tgzhttps://github.com/mongodb/mongo-php-driver/releases/download/1.3.2/mongodb-1.3.2.tgz

图片 8

cat /dev/null > docker-compose.yaml

如上正是本文的全体内容,希望对大家的读书抱有援救,也指望大家多多支持脚本之家。

cat >> docker-compose.yaml <

您恐怕感兴趣的篇章:

  • 详解使用Docker容器来源码编写翻译etcd
  • Ubuntu Docker 源码编写翻译(壹.玖.1)详解

version: "2"

services:

  mysql:

    build:

      context: ./app/mysql

      dockerfile: Dockerfile

    environment:

      MYSQL_ROOT_PASSWORD: "root"

      MYSQL_DATABASE: "app"

      MYSQL_USER: "app"

      MYSQL_PASSWORD: "111111"

    volumes:

      - ./db:/var/lib/mysql

  php:

    build:

      context: ./app/php

      dockerfile: Dockerfile

    volumes:

      - ./web:/opt/web

  nginx:

    build:

      context: ./app/nginx

      dockerfile: Dockerfile

    ports:

      - 8080:80

    depends_on:

      - php #那边代表nginx依赖php,php会在nginx此前运转

    volumes_from:

      - php

    volumes:

      - ./app/nginx/conf:/etc/nginx/conf.d

  redis:

    build:

      context: ./app/redis

      dockerfile: Dockerfile

#    ports:

#      - 6379:6379

  memcached:

    build:

      context: ./app/memcached

      dockerfile: Dockerfile

#    ports:

#      - 11211:11211

  mongo:

    build:

      context: ./app/mongo

      dockerfile: Dockerfile

#    ports:

#      - 27017:27017

  phpmyadmin:

    build:

      context: ./tools/phpmyadmin

      dockerfile: Dockerfile

    ports:

本文由澳门威利斯人发布于威利斯人娱乐,转载请注明出处:详解Docker源码编译安装,搭建即收即毁的临时邮

关键词: 澳门威利斯人 小白运维之路 运维