Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Docker ไงจะใครล่ะ

Docker ไงจะใครล่ะ

CPE Mini Conference 2016

Manatsawin Hanmongkolchai

August 31, 2016
Tweet

More Decks by Manatsawin Hanmongkolchai

Other Decks in Programming

Transcript

  1. Me • SKE ป 4 • Intern @ Wongnai (วงในก็ใช

    Docker นะ!) • whs.in.th • [email protected] (เพิ่งเซตเมลใหมดวย Docker ขอเหอหนอย)
  2. Linux Docker Linux VirtualBox App Library Configuration Container App Library

    Configuration Container App Linux Configuration Virtual machine Library App Linux Configuration Virtual machine Library * วาดแบบหยาบๆ
  3. Linux Docker Linux VirtualBox App Library Configuration Container App Shared

    Library Configuration Container App Linux Configuration Virtual machine Library App Linux Configuration Virtual machine Library * วาดแบบหยาบๆ Library
  4. sudo mkdir /var/www/ /var/grader/ sudo chown www-data:www-data /var/www sudo cp

    -r assets server templates index.html /var/www/ sudo cp -r vm/graderclient/ /var/grader/ ลง grader web
  5. sudo cp vagrant/nginx.conf /etc/nginx/sites-available/def ault sudo service nginx restart เซต

    web server นี่คือกอปไฟลสําเร็จมาแลวดวยนะ ไมไดเซตเอง
  6. Dockerfile FROM django:1.9-python3 ADD https://github.com/just-containers/s6-overlay/releases/download/v1.18.1.3/s6-overlay-amd64.tar.gz /tmp/ ADD https://github.com/vishnubob/wait-for-it/raw/master/wait-for-it.sh /usr/bin/ ENTRYPOINT

    ["/init"] EXPOSE 80 RUN tar xzf /tmp/s6-overlay-amd64.tar.gz -C / && \ rm /tmp/s6-overlay-amd64.tar.gz && chmod +x /usr/bin/wait-for-it.sh RUN apt-get update && apt-get install -y pwgen nginx-light libffi-dev && \ rm -rf /var/lib/apt/lists/* && \ rm /var/www/htdocs/* || true RUN pip3 install gunicorn dj_database_url && \ useradd -d /grader -MN -s /bin/false grader && \ mkdir -p /data/media && chown -R grader /data COPY . /grader RUN cd /grader/docker && tar -c * | tar -C /etc -x && cd /grader && rm -r /grader/docker/ && \ pip3 install -r requirements.txt && \ echo "STATIC_ROOT = '/var/www/htdocs/'" > /grader/grader/local_settings.py && \ python3 manage.py collectstatic -l --no-input
  7. * Docker Swarm ลงงาย มี WebUI ดวย "Planet scale" by

    Google ลงงายกวา พังงายดวย Classic