Just like you can push your code to Github/Gitlab.
You can push images to docker registries
Docker Hub: The main public repository for Docker images. You can find a wide variety of pre-built images for popular software like Node.js, MongoDB, PostgreSQL, etc. Simply pull an image using:
javascriptdocker pull <image-name>
javascriptdocker pull node
Private Repository : If you're working in a company, you might store Docker images in a private repository. Docker Hub allows private repositories, or you can use alternatives like:
AWS Elastic Container Registry (ECR)
Google Container Registry (GCR
Azure Container Registry (ACR)
You can create your own Docker image using a Dockerfile that specifies the dependencies and setup for your app. Build the image with:
javascriptdocker build -t <your-image-name> .
GitHub Packages: You can store Docker images in GitHub's package registry, useful for integrating with your CI/CD workflows.
javascriptdocker pull <image-name>
example:
javascriptdocker pull node
javascriptdocker images
javascriptdocker rmi <image-id>
javascriptdocker run -d --name <container-name> <image-name>
example:
javascriptdocker run -d --name my-app node
javascriptdocker ps
javascriptdocker ps -a
javascriptdocker stop <container-name>
javascriptdocker rm <container-name>
javascriptdocker start <container-name>
javascriptdocker exec -it <container-name> /bin/bash
These commands will help you navigate Docker from basic usage to more advanced operations. Keep this cheat sheet handy as you work with Docker! Happy coding! 🚀