How to cook 👨‍🍳 Docker with React. Part 1 — Base Theory and commands.

Photo by Ian Taylor on Unsplash

Basis

Docker. For what?

Docker allows to create and run packed containers.

Terms of Docker

  • Docker daemon — a service for working with containers.
  • Docker client cli for daemon management Docker daemon (^).
  • Docker image — unchangeable file which can run container. Applications being packed exactly in images, from whom runs containers.
  • Dicker container — runned from image working (hope so) application.
  • Docker registry — repository (storage) with docker images.

Docker commands

Source:

Main (useful) commands of Docker CLI

  • run — command for running container. The docker run command first creates a writeable container layer over the specified image, and then starts it using the specified command.
  • push — pushes image to repository
  • ps — shows the list of containers
  • attach — connects to running container
  • rm — deletes container(s)
  • rmi — deletes image(s)
  • start/stop/restart — action with container :)
  • build — creates image from Dockerfile

Main (useful) commands Dockerfile

  • FROM — initalizes new step of building and sets base image
  • RUN — executes command in a container. Execute any commands in a new layer on top of the current image and commit the results. The resulting committed image will be used for the next step in the Dockerfile.
  • ENV — sets env variable
  • WORKDIR — sets working directory, where next commands will be executed
  • CMD — sets default args for container’s ENTRYPOINT
  • ENTRYPOINT — configures what will be runned on container’s start
  • EXPOSE — “says” to the Docker which port should listen container on running
  • COPY — copies files from to container

Summary

  • For the app instruction’s creation (how, where and what app should to do) exists Dockerfile
  • For running commands Docker as service and image’s creation and then running exists Docker CLI

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aleksandr Denisevich

Aleksandr Denisevich

Web developer with 7+ years experience. Currently work with React, RxJs, Web3