Docker alternative –> Colima
Commands
| Command | Description |
|---|---|
| .docker run <image/contaner_name> | |
| docker ps | List containers |
| sudo docker logs id_chunk –follow | logs |
| docker ps --format "table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Image}}" | List containers in a nicer way |
| docker ps –format “table \t\t\t” | ignore this in web, obsidian version of above |
| docker stop |
Stop |
| docker stop $(docker ps -aq) | Stop All |
| docker ps -a | All container that were ran |
| docker rm |
Remove |
| docker images | list images |
| docker rmi | remove images - ENSURE NO CONTAINERS RUN ON IT |
| docker pull |
alternative to run, only pulls without running |
| docker run ubuntu sleep 5 | run ubuntu, sleep 5sec, exit ubuntu |
docker exec -it container_id bash |
interactive terminal in container |
docker cp container_id:path_to_file local_path |
copy file from container |
| docker run –name |
RUN/download and run image |
| docker images -a -q | xargs docker rmi -f | remove all images |
| docker run -i |
interactive mode - map stinput to docker containtainer(no terminal prompts will be provided) |
| docker run -it <name | interactive + terminal prompts |
| docker run -p 80:5000 |
map port 80 to 5000 localhost |
| docker run -v ext_path:internal_docker_path |
volume mapping of ext docker path to internal in order to persist db |
| docker inspect |
inspects container in json format |
| docker run -e APP_COLOUR=blue |
set ENV variable within container |
| docker history |
shows size of command by dockerfile |
| You can either open the file using vi /root/webapp-color/Dockerfile (or using commands such as cat/more/less/vim e.t.c) and look for the FROM instruction or search for it directly using grep -i FROM /root/webapp-color/Dockerfile. | Check docker file |
| docker build -t new_app_name | Build a docker image using the Dockerfile and name it |
| docker run |
inspect OS release version |