# Docker overview
Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker's methodologies for shipping, testing, and deploying code, you can significantly reduce the delay between writing code and running it in production. Documentation.
# Basic most used commands:
Start container:
docker start <container_id>
docker stop <container_id>
docker restart <container_id>
docker exec -it <container_id> bash
docker exec -it <database_container_name> psql -U <database_user> -W <database_name>"database_container_name" - name of container, described in docker-compose.yaml file.
user@localhost:~$ docker system pruneDocker daemon ask about confirmation. Here -a or --all option remove all unused images not just dangling ones, -f or --force option do not prompt for confirmation, --volumes prune anonymous volumes. Documentation.
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- unused build cache
Are you sure you want to continue? [y/N]
docker build -f my.Dockerfile .
docker network ls
docker inspect <container_id> | grep IPAddress
docker save <container_name> > image_name.tar
docker load < image_name.tar
docker run -d --network=host -v /path/on/host/machine:/path/in/container <container_name>