Full Config ubuntu 14.04
發表於 : 2017-07-05 13:46:47
1.install docker
sudo apt-get remove docker docker-engine
sudo apt-get update
sudo apt-get install \
linux-image-extra-$(uname -r) \
linux-image-extra-virtual
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce
2.add user to docker group
sudo gpasswd -a user docker
3.logout/login
4.make ~/Dockers
5.docker pull nginx
6.docker pull mariadb
7.docker pull php:5.6-fpm
8.mkdir ~/Dockers/php56fpm
9.vi ~/Dockers/php56fpm/Dockerfile
FROM php:5.6-fpm
RUN docker-php-ext-install -j$(nproc) pdo_mysql
RUN docker-php-ext-install -j$(nproc) mbstring
RUN docker-php-ext-install -j$(nproc) tokenizer
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
10.cd ~/Dockers/php56fpm/
11.docker build -t myphp:5.6-fpm .
12.vi ~/Dockers/portainer.sh
#/bin/bash
docker run -d -p 9001:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer --admin-password '$2y$05$Z3xMgET8h7j0c6WkmdXDNuNuNeE8U6BuQP66AI9To5ZoBR71.Cu1u'
13.chmod +x ~/Dockers/portainer.sh
14.~/Dockers/portainer.sh
15.mkdir ~/Dockers/auto/
16.mkdir ~/Dockers/auto/conf.d/
17.vi ~/Dockers/auto/docker-compose.yml
www_data:
image: busybox
volumes:
- /var/www/html:/var/www/html
mariadb:
container_name: mariadb
restart: always
image: mariadb:latest
environment:
- MYSQL_ROOT_PASSWORD=secret
- MYSQL_DATABASE=homestead
- MYSQL_USER=homestead
- MYSQL_PASSWORD=secret
volumes:
- ~/Dockers/mariadb:/var/lib/mysql/
php56:
container_name: php56
restart: always
image: myphp:5.6-fpm
links:
- mariadb:db
environment:
- DB_HOST=mariadb
volumes:
- ~/Dockers/auto/custom.ini:/usr/local/etc/php/conf.d/custom.ini
volumes_from:
- www_data
working_dir:
/var/www/html
nginx:
container_name: nginx
restart: always
image: nginx
ports:
- "55180:80"
- "55143:443"
links:
- php56:php56
volumes:
- ~/Dockers/auto/conf.d:/etc/nginx/conf.d
- /etc/ssl:/etc/ssl:ro
volumes_from:
- www_data
18.install docker-compose
sudo su
curl -L https://github.com/docker/compose/relea ... ose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose -v
exit;
19.cd ~/Dockers/auto
20.vi ~/Dockers/auto/conf.d/do1.conf
server {
listen 80;
root /var/www/html/;
index index.php index.html index.htm;
server_name server;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php56:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
listen 443 ssl;
root /var/www/html/;
index index.php index.html index.htm;
ssl_certificate /etc/ssl/server.crt;
ssl_certificate_key /etc/ssl/server.key;
server_name server;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php56:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
21.vi ~/Dockers/auto/custom.ini
date.timezone = "Asia/Taipei"
extension=/var/www/html/ixed.5.6.lin
22.scp ixed.5.6.lin
scp -pr ixed.5.6.lin user@server:/home/user/Dockers/auto
23.scp ssl
scp -pr star* user@server:/home/user/Dockers/auto/ssl
24.sudo cp ixed.5.6.lin /var/www/html/
25.docker-compose up -d
sudo apt-get remove docker docker-engine
sudo apt-get update
sudo apt-get install \
linux-image-extra-$(uname -r) \
linux-image-extra-virtual
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce
2.add user to docker group
sudo gpasswd -a user docker
3.logout/login
4.make ~/Dockers
5.docker pull nginx
6.docker pull mariadb
7.docker pull php:5.6-fpm
8.mkdir ~/Dockers/php56fpm
9.vi ~/Dockers/php56fpm/Dockerfile
FROM php:5.6-fpm
RUN docker-php-ext-install -j$(nproc) pdo_mysql
RUN docker-php-ext-install -j$(nproc) mbstring
RUN docker-php-ext-install -j$(nproc) tokenizer
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
10.cd ~/Dockers/php56fpm/
11.docker build -t myphp:5.6-fpm .
12.vi ~/Dockers/portainer.sh
#/bin/bash
docker run -d -p 9001:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer --admin-password '$2y$05$Z3xMgET8h7j0c6WkmdXDNuNuNeE8U6BuQP66AI9To5ZoBR71.Cu1u'
13.chmod +x ~/Dockers/portainer.sh
14.~/Dockers/portainer.sh
15.mkdir ~/Dockers/auto/
16.mkdir ~/Dockers/auto/conf.d/
17.vi ~/Dockers/auto/docker-compose.yml
www_data:
image: busybox
volumes:
- /var/www/html:/var/www/html
mariadb:
container_name: mariadb
restart: always
image: mariadb:latest
environment:
- MYSQL_ROOT_PASSWORD=secret
- MYSQL_DATABASE=homestead
- MYSQL_USER=homestead
- MYSQL_PASSWORD=secret
volumes:
- ~/Dockers/mariadb:/var/lib/mysql/
php56:
container_name: php56
restart: always
image: myphp:5.6-fpm
links:
- mariadb:db
environment:
- DB_HOST=mariadb
volumes:
- ~/Dockers/auto/custom.ini:/usr/local/etc/php/conf.d/custom.ini
volumes_from:
- www_data
working_dir:
/var/www/html
nginx:
container_name: nginx
restart: always
image: nginx
ports:
- "55180:80"
- "55143:443"
links:
- php56:php56
volumes:
- ~/Dockers/auto/conf.d:/etc/nginx/conf.d
- /etc/ssl:/etc/ssl:ro
volumes_from:
- www_data
18.install docker-compose
sudo su
curl -L https://github.com/docker/compose/relea ... ose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose -v
exit;
19.cd ~/Dockers/auto
20.vi ~/Dockers/auto/conf.d/do1.conf
server {
listen 80;
root /var/www/html/;
index index.php index.html index.htm;
server_name server;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php56:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
listen 443 ssl;
root /var/www/html/;
index index.php index.html index.htm;
ssl_certificate /etc/ssl/server.crt;
ssl_certificate_key /etc/ssl/server.key;
server_name server;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php56:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
21.vi ~/Dockers/auto/custom.ini
date.timezone = "Asia/Taipei"
extension=/var/www/html/ixed.5.6.lin
22.scp ixed.5.6.lin
scp -pr ixed.5.6.lin user@server:/home/user/Dockers/auto
23.scp ssl
scp -pr star* user@server:/home/user/Dockers/auto/ssl
24.sudo cp ixed.5.6.lin /var/www/html/
25.docker-compose up -d