熊尼玛的七亩地 ( ̄(エ) ̄)

Ubuntu 16.04 install docker


https://docs.docker.com/engine/installation/linux/ubuntulinux/

Update apt sources

$ sudo apt-get update 
$ sudo apt-get install apt-transport-https ca-certificates 

Add the new GPG key.

$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

Modify /etc/apt/sources.list.d/docker.list

deb https://apt.dockerproject.org/repo ubuntu-xenial main

Update the APT package index. Purge the old repo if it exists. Verify that APT is pulling from the right repository.

$ sudo apt-get update
$ sudo apt-get purge lxc-docker
$ apt-cache policy docker-engine.

Docker. Start the docker daemon. Create the docker group. Add your user to docker group.

$ sudo apt-get install docker-engine
$ sudo service docker start
$ sudo groupadd docker
$ sudo usermod -aG docker ubuntu

Log out and log back in.

$ docker run hello-world

If this fails with a message similar to this:

Cannot connect to the Docker daemon. Is 'docker daemon' running on this host?

Check that the DOCKER_HOST environment variable is not set for your shell. If it is, unset it.

Docker odoo 环境


https://github.com/noahzaozao/odoo_docker

0.1 Dockerfile

FROM debian:jessie
MAINTAINER Odoo S.A. 

RUN rm /etc/apt/sources.list
COPY ./sources.list /etc/apt/sources.list
COPY ./.pydistutils.cfg /root/.pydistutils.cfg

# Install some deps, lessc and less-plugin-clean-css, and wkhtmltopdf
RUN set -x; \
        apt-get update \
        && apt-get install -y --no-install-recommends \
            ca-certificates \
            curl \
            node-less \
            node-clean-css \
            python-pyinotify \
            python-renderpm \
            python-support \
            python-pip \
            gcc \
            python-dev \
            libldap2-dev \
            libsasl2-dev \
            libpq-dev \
            libjpeg-dev \
            libxml2-dev \
            libxslt-dev \
        && curl -o wkhtmltox.deb -SL http://nightly.odoo.com/extra/wkhtmltox-0.12.1.2_linux-jessie-amd64.deb \
        && echo '40e8b906de658a2221b15e4e8cd82565a47d7ee8 wkhtmltox.deb' | sha1sum -c - \
        && dpkg --force-depends -i wkhtmltox.deb \
        && apt-get -y install -f --no-install-recommends \
        && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false npm \
        && rm -rf /var/lib/apt/lists/* wkhtmltox.deb

# Copy entrypoint script and Odoo configuration file
COPY ./entrypoint.sh /
COPY ./openerp-server.conf /etc/odoo/

# Mount /var/lib/odoo to allow restoring filestore and /mnt/extra-addons for users addons
RUN mkdir -p /mnt/extra-addons 
VOLUME ["/var/lib/odoo", "/mnt/extra-addons"]

# Expose Odoo services
EXPOSE 8069 8071

# Set the default config file
ENV OPENERP_SERVER /etc/odoo/openerp-server.conf

RUN mkdir /home/odoo
WORKDIR /home/odoo
COPY ./odoo/requirements.txt /home/odoo/requirements.txt

RUN pip install -r requirements.txt

0.2 Debian APT Source list

deb http://mirrors.ustc.edu.cn/debian stable main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian stable main contrib non-free
deb http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free

0.3 .pydistutils.cfg

[easy_install]
index-url=http://mirrors.aliyun.com/pypi/simple

1. Build

docker build -t odoo_docker .

2. Start

docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db -p 5432:5432 postgres
docker run -p 8069:8069 --name odoo --link db:db -it -v $(pwd)/odoo:/home/odoo odoo_docker

3. dev start

python openerp-server --addons-path=/home/odoo/addons --db_host db -d odoo -r odoo -w odoo

Docker clean


清理docker环境(慎用!!!)

docker kill $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes

Docker nsenter


https://github.com/jpetazzo/nsenter

进入容器方法

docker run --rm -v /usr/local/bin:/target jpetazzo/nsenter

Docker django 环境


https://github.com/noahzaozao/Docker-Nginx-Django-Redis-Mysql

1.启动mysql

#!/usr/bin/env bash
docker run --name mysql \
-v $(pwd)/conf.d:/etc/mysql/conf.d \
-e MYSQL_ROOT_PASSWORD=mysqlpassword \
-p 3307:3306 \
-d mysql:5.6.30 \
--character-set-server=utf8 --collation-server=utf8_unicode_ci
sleep 15
docker exec -d mysql mysql -pmysqlpassword -e "create database main"

2.启动redis

docker run --name redis -d redis:3.0.7

3.启动django

#!/usr/bin/env bash
docker build -t django-app .
docker run --name django \
-v /usr/src/app \
-v /usr/src/app/static \
--link mysql:mysql \
--link redis:redis \
-p 12000:8000 \
-d django-app /usr/local/bin/gunicorn web_django.wsgi:application -w 1 -b :8000

4.初始化django

#!/usr/bin/env bash
echo 'migrate database main'
docker exec -it django python manage.py migrate
echo 'create superuser admin'
docker exec -it django python manage.py createsuperuser --username admin --database default

5.启动nginx

docker build -t nginx .
docker run --name nginx-server \
--link django:web \
-v /www/static \
--volumes-from django \
-p 80:80 \
-d nginx

Hello World


本文展示了一些不同类型的正文使用Bootstrap支持的风格。基本排版,图像,和代码的支持。


正文区域链接,正文区域。

引用的正文区域。加粗正文区域。

正文区域斜体正文区域。

Heading

正文区域。

Sub-heading

正文区域。

Example code block

正文区域。

Sub-heading

正文区域。

  • 列表区域。
  • 列表区域。
  • 列表区域。