Docker basic commands

PHOTO EMBED

Fri Oct 01 2021 11:30:05 GMT+0000 (UTC)

Saved by @alexactivate #docker

docker ps //List running containers
docker ps --all //List all containers
docker system prune //Remove unused data
docker system prune --all //Remove all unused images not just dangling ones
docker run {IMAGE} //combining 'docker create' & 'docker start'
docker run -d {IMAGE} // Run container in background and print container ID
docker run -p {systemport}:{dockerport} {IMAGE} // Map Port of the OS to the dockerport
docker run -it {IMAGE} //Input output
docker run -it {IMAGE} sh //Run docker container and shell into it
docker exec -it {IMAGE} sh //Shell into running docker container
docker build . //Build docker image with random id 
docker build -t {REPO}/{TAGNAME}. //Build docker image with random id 
docker stop {IMAGE} //Stop container from running

docker-compose up //Execute docker compose
docker-compose up --build // Rebuild Docker container and execute docker compose
docker-compose -d {IMAGE} // Run container in background and print container ID
docker-compose down //Stop container from running
content_copyCOPY