Skip to content

Latest commit

 

History

History
85 lines (62 loc) · 2.89 KB

ReadMe.md

File metadata and controls

85 lines (62 loc) · 2.89 KB

Docker

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers.

Docker Image Vs Docker Container

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.

Prerequities

  1. Docker Desktop
  2. Visual Studio Code
  3. Remote Development - Visual Studio Code Extension

Basic Docker Commands

$ 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

Developing using Docker

  1. Using Docker commands (build and run). Server will run only on Port No 3200.

    1. Build Docker Image

      $docker build -t image_name_rajat .
    2. Run Docker Image (image in running state is known as container)

      $docker run -d -p 3200:3000 image_name_rajat
  2. Using Docker Compose command. Server will run only on Port No 3300.

    1. Build and Run Docker Image

      $docker compose up
  3. Using Remote Development (Visual Studio Code Extension)

    1. Open an existing folder in a container. Server will run only on Port No 3400.
    2. Open a Git repository or GitHub PR in an isolated container volume. Server will run only on Port No 3600.
    3. Open a folder on a remote SSH host in a container
    4. Attach to a running container

Reference Articles

  1. Dev Containers tutorial
  2. Create a Dev Container
  3. Develop on a remote Docker host
  4. Developing inside a Container