Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers.
An image, which is a set of layers as you describe. An instance of an image is called a container. If you start this image, you have a running container of this image. You can have many running containers of the same image.
$ docker images
You will get a list of all local Docker images with the tags specified.
$ docker build -t image_name_rajat .
It will create image
$ docker run -d -p 3001:3001 image_name_rajat
It will run docker image
$ docker ps
See all docker running containers
$ docker ps -a
See all docker containers
$ docker stop container_id
It will stop docker container
$ docker compose up
It will build image and run image
-
Using Docker commands (build and run). Server will run only on Port No 3200.
-
Build Docker Image
$docker build -t image_name_rajat .
-
Run Docker Image (image in running state is known as container)
$docker run -d -p 3200:3000 image_name_rajat
-
-
Using Docker Compose command. Server will run only on Port No 3300.
-
Build and Run Docker Image
$docker compose up
-
-
Using Remote Development (Visual Studio Code Extension)
- Open an existing folder in a container. Server will run only on Port No 3400.
- Open a Git repository or GitHub PR in an isolated container volume. Server will run only on Port No 3600.
- Open a folder on a remote SSH host in a container
- Attach to a running container