docker
Docker Quickstart
List images on machine:
docker images
Pull down a new image:
docker pull swaggerapi/petstore
List containers:
docker ps # List all, including stopped containers: docker ps -a ## E.g. output: CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4ceada07ea84 swaggerapi/petstore "bash /petstore/run.…" 4 seconds ago Up 3 seconds 0.0.0.0:8080->8080/tcp dreamy_euclid 8fc469fed0a9 mongo "docker-entrypoint.s…" 8 months ago Up 4 weeks 0.0.0.0:27017->27017/tcp mongodb
Start a container from an image:
docker run --platform linux/amd64 -p 8080:8080 -d swaggerapi/petstore # Start a container with an exposed port to the local machine: container 8080 -> local 8080 docker run -p 8080:8080 -d swaggerapi/petstore # Do the same on mac M1 for an image that wasn't meant for it: docker run --platform linux/amd64 -p 8080:8080 -d swaggerapi/petstore
Stop a container:
docker stop <name>
Go in to the container using bash to look around:
docker exec -it dreamy_euclid bash