Git Product home page Git Product logo

common-docker-script's Introduction

common-docker-script

Apache + PHP

$ docker run --name apache-php -d -p 20080:80 -p20443:443 --restart always \ -v $HOME/Desktop/docker/apache-php/www:/var/www/app/ romeoz/docker-apache-php

Reverse Proxy

$ sudo docker run -p 80:80 -p 443:443 -p 22:22 -p 8080:8080 -p 28888:8888 \ -it --restart always -d \ -v /var/run/docker.sock:/tmp/docker.sock:ro \ -v $HOME/Desktop/docker/neilpang/proxy/certs:/etc/nginx/certs \ -v $HOME/Desktop/docker/neilpang/proxy/acme:/acmecerts \ -v $HOME/Desktop/docker/neilpang/proxy/conf.d:/etc/nginx/conf.d \ -v $HOME/Desktop/docker/neilpang/vhost.d:/etc/nginx/vhost.d \ -v $HOME/Desktop/docker/neilpang/stream.d:/etc/nginx/stream.d \ -v $HOME/Desktop/docker/neilpang/dhparam:/etc/nginx/dhparam \ --name reverse-proxy neilpang/nginx-proxy

GitLab

$ sudo docker run --detach \ --hostname yhw.gitlab.com \ -e VIRTUAL_HOST=yhw.gitlab.com \ --publish 10080:80 --publish 10443:443 --publish 10022:22 \ --name gitlab --restart always \ --volume $HOME/Desktop/gitlab/config:/etc/gitlab \ --volume $HOME/Desktop/gitlab/logs:/var/log/gitlab \ --volume $HOME/Desktop/gitlab/data:/var/opt/gitlab \ gitlab/gitlab-ce:latest

$ sudo docker run --detach --hostname serverIP
--publish ???:443 --publish ???:80 --publish ???:22
--name gitlab --restart always
--volume $HOME/Desktop/gitlab/config:/etc/gitlab
--volume $HOME/Desktop/gitlab/logs:/var/log/gitlab
--volume $HOME/Desktop/gitlab/data:/var/opt/gitlab
gitlab/gitlab-ce:latest

docker run: 生成 container 及執行
--detach, -d: 在背景執行
--hostname: 設定 host
--publish, -p: 將外部的port和內部的連結
ex: [10443:443] 主機端的10443 port 即對應 Container 的 443 port
443 - https, 80 - http, 22 - SSH
--name: 設定 Container 的 name
--restart always: 每次主機重新開機即執行Container
--volume A:B: Link主機及Container的Volume (備份用)
ex: [/$HOME/Desktop/gitlab/logs:/var/log/gitlab] A和B的資料將會同步, A是在主機的
資料夾, B則是在Container裡的資料夾
gitlab/gitlab-ce:latest: 要用的 image (如果本機沒有會自動pull)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.