I create environment for machine learning (xgboost, lightgbm) with docker.
- build images or restart container
- excecute container and show bash script of docker
- execute python script
// terminal
docker-compose up --build
docker start -a [container id || container name] // contatiner already created
docker exec -it [container id || container name] bash // '-it': need intractive process like a shell
// container
python script/test.py
// terminal
docker stop [container id || container name]
- build, run options
docker build -t #{docker id}/#{project name}:#{version} . // set image name
docker run --name hoge -it hogehoge:latest // set container name
docker run -v #{host directory}:#{container directory} -it hogehoge:latest // use local file
docker run -d hoge // run images on background
- commit (create image from container)
docker commit -c #{new order} [container] #{docker id}/#{project name}:#{version}
- docker-compose
docker-compose up -d // launch in background
docker-compose dows // stop all container
docker-compose ps // use only directory as 'docker-compose.yml' file
- remove containers or images
docker system prune // remove stopped container, not tags images, not uses volume and networks
docker container prune // remove stopped containers
docker image prune // remove stopped images
// remove the container or image
docker rm [container id]
docker rmi [image id]
- remove local changes
git checkout .
- remove all file (back to commit)
git clean -df .
- reset command
git add: working tree -> index git commit: index -> local repository git push: local repository -> remote repository
// reset latest commit
git reset --soft HEAD^
// reset latest commit, add, working tree
git reset --hard HEAD^
// reset all commit changes
git reset --hard HEAD
// reset all add changes
git reset --mixed HEAD
// remove reset
git reset --hard ORIG_HEAD
- connect to AWS, Mysql, kubernetes
- running lightgbm on docker and aws
├── Dockerfile
├── README.md
├── docker-compose.yml
├── mysql
│ ├── Dockerfile
│ ├── db
│ │ └── init.sql
│ └── my.cnf
└── script
└── test.py
- build images
- open command prompt
- open mysql and sql command
- reset db and remove container (better not to do?)
// terminal
docker-compose up --build
docker exec -it mysql-host bash
// mysql (container)
mysql -u [MYSQL_ROOT_PASSWORD] -p
show database;
use [table name];
// terminal (reset db and remove container)
docker-compose down