Last active
February 22, 2016 03:20
-
-
Save marulitua/c7fe7ad457376330cca7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
========================HOW TO HOST UPLOAD SCRIPT with DOCKER======================== | |
1. Make sure docker was installed and running | |
2. Get proper image | |
Kita akan menggunakan image web server nginx yang sudah terinistall | |
dan terkonfigurasi dengan php-fpm. | |
Image yang akan kita gunakan adalah richarvey/nginx-php-fpm dari https://hub.docker.com/r/richarvey/nginx-php-fpm/ | |
untuk mendownload image dari registry (repo hub.docker.com) jalankan | |
sudo docker pull richarvey/nginx-php-fpm | |
3. Get upload sript | |
Buat directory baru untuk menyimpan sript upload dan down load script upload | |
dari https://gist.github.com/marulitua/ac1f42c3b95b86691b0b | |
Misal /home/yudi/new_taxi dan didalamnya ada file upload.php | |
4. Jalankan image server | |
sudo docker run --name nginx -p 8080:80 -dit -v /home/yudi/new_taxi:/usr/share/nginx/html richarvey/nginx-php-fpm | |
perintah diatas akan menjalankan image dengan option sebagai berikut : | |
~ -p 8080:80 | |
pulish port 80 di guest os ke port 8080 di host os, jadi di host kita bisa akses dari localhost:8080 | |
~ -dit -v /home/yudi/new_taxi:/usr/share/nginx/html | |
mount directory /home/yudi/new_taxi sebagai /usr/shr/nginx/html di guest os | |
~ --name nginx | |
beri nama container sebagai "nginx" agar mempermudah pemanggilan nantinya | |
~ -itd | |
Run container in background and print container ID | |
Keep STDIN open even if not attached | |
Allocate a pseudo-TTY | |
Jika container berhasil dijalankan | |
upload ke http://localhost:8080/upload.php dengan key "file" | |
jika berhasil di /home/yudi/new_taxi akan muncul directory baru yang berisi file yang diupload | |
untuk menghentikan container | |
sudo docker stop nginx | |
untuk menghapus container | |
sudo docker rm nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment