- Files
- Diagram
- Logging in to VM
- Install Docker Engine
- Upload flask-sample to VM
- Build Docker Image
- List Docker Image
- Create Folders and Add files
- Add VM Port
- Run Docker Image
- Check Docker Container
- Check API from Browser
- Docker Container Log
- Into the Container
- Use Postman to Check API
- Copy a file from Container to VM
- Copy a file from VM to Container
- Stop Container
- Remove Container
- Remove Docker Image
- Contributor
- Blog
- License
No | Folder | Comment |
---|---|---|
1 | Script | Install Docker package using this script |
2 | flask-sample | Build an web app by using Python and Flask |
- On Local
ssh VM-ACCOUNT@VM-IP
- On Local
Download https://github.com/ArcherHuang/Docker-Python-Flask Repository cd to Docker-Python-Flask Repository scp ./Script/install-docker.sh VM-ACCOUNT@VM-IP:~
- On VM
cd ~ chmod 777 install-docker.sh sudo ./install-docker.sh
- On VM
mkdir ~/flask-sample
- On Local
scp flask-sample/* VM-ACCOUNT@VM-IP:~/flask-sample
- On VM
cd ~/flask-sample sudo docker build -t mmosconii/docker-python:0.1 .
- On VM
sudo docker images
- On VM
mkdir ~/dataset-out ~/model-out echo "hello" > ~/dataset-out/1.txt echo "world" > ~/model-out/2.txt
- On Chrome
- On VM
sudo docker run -d -p 80:80 --name=test-dev -v ~/dataset-out:/dataset -v ~/model-out:/model mmosconii/docker-python:0.1
- On VM
sudo docker ps -a
- On Local
- On VM
sudo docker logs -f test-dev
- On VM
sudo docker exec -it test-dev bash
Use Postman to Check API
- GET API
- GET http://VM-IP
- POST API
- POST http://VM-IP/store
- Body
{ "run": 6611 }
- On VM
echo "Lucky seven" > ~/filename.txt
sudo docker ps -a
sudo docker cp CONTAINER-ID:/app/filename.txt ~/777.txt
sudo docker ps -a
sudo docker cp ~/filename.txt CONTAINER-ID:/app/filename.txt
- On VM
sudo docker ps -a sudo docker stop CONTAINER-ID
- On VM
sudo docker ps -a sudo docker rm CONTAINER-ID
- On VM
sudo docker image prune -a
This sample is licensed under the MIT license.