[docker] Basic command

docker ps
-> viewing running containers

docker image ls
-> viewing images that have been built/pulled

(1) Can do everything locally — create docker file & build & deploy
(2) Can pull existing images from docker hub

  1. Create the docker file

If you create a lot of RUN commands — it is inefficient. (creates additional layers in the image)

2. Build the docker file (=create an image)
- Go into the directory with docker file
-
-

  • docker image ls
    -> should be able to see the image
  • Docker COMMIT command (easy way)
    → inside docker container, you download stuff and then you can commit the container as it is to be an image

3. Run the Image!
(Option) can push to docker hub for further usage
OR can run from local repository directly (image ls)
Interactively running docker images :

entrypoint can be /bin/bash etc — or else conainer will exit right away
can do or to add more commands

4. How to build a new customized docker image

Create Docker file (maybe based on an existing image)

And then build the image first (go to directory which has Dockerfile)

Then tag the image to push to container registry
Grab the image ID : random letters

Then push image to docker hub

ECR basic commands

How to use ECR
1. Login to AWS ECR registry first (= same as docker login)
NO need to fill in username or password — just the command itself

2. Build your docker image

--

--

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