Docker : Operating system-level virtualization (not VM). It packages the environment so code, libraries, and dependencies can run on all platforms.
Docker Hub: GitHub, but for Docker images.
Docker container : A running instance of a Docker image.
Docker image : Packages libraries, files, project code, and environment built from a Dockerfile.
Dockerfile : Setup file for building an image.
// Quick Parameter Replacer (Updates "What I use" below in real-time)
Container Name:
Image:
Host Port:
Container Port:
Dockerfile
FROM [base-image]
WORKDIR [directory-path] << main working directory in container
COPY [host-path] [container-path] << copy file/folder into container
RUN [command] << example: RUN npm install
CMD ["sh", "-c", "command1 && command2"] << example: CMD ["node", "server.js"]
EXPOSE [port] << port container listens on (in container)
docker [options / subcommands]
ps << show running containers
ps -a << show all containers (stopped or running)
images << show all images on machine
pull [image] << pull image from Docker Hub
build -t [image_name] [path] << build and tag/name an image
run --name [container-name] [image] << create and start a new container
start [id/name] << start stopped container
exec -it [container-id] /bin/bash << connect / open shell in container
rm [name/id] << remove container
rmi [name/id] << remove image
What I use
docker run -d -it --name [container-name] -p [host-port:container-port] [image]
docker exec -it [container] /bin/bash << or /bin/sh
.mymoonnote