Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@myas92
Last active August 31, 2022 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myas92/d3e96ae34fc36e7562fbb6d91edbb80b to your computer and use it in GitHub Desktop.
Save myas92/d3e96ae34fc36e7562fbb6d91edbb80b to your computer and use it in GitHub Desktop.

How to install docker

  • Docker's internal repos is not supported on 20.04 yet so
  • before installation
    • use a proxy or vpn sudo openconnect 986.9104.945.9196
  • sudo apt-get install -y docker.io based on stackoverflow answer
  • for getting images form dockerhub
  • add nameserver of shekan to /etc/resolve.conf -- (sudo /etc/resolve.conf)
    • nameserver 192.168.1.58
    • nameserver 192.168.1.100
    • nameserver 178.22.122.100
    • nameserver 185.51.200.2
  • and sign in to docker
  • sudo docker login then enter username and password of docker account based on this answer

How to create a image (Node)

  • bease on this tutorial
  • create a Dockerfile
  • sudo docker build -t yaser/node-hello-app . (run many many times)
    • for each times create a new image if codes have edited
  • sudo docker image ls
  • sudo docker run --rm -d -p 3000:3001 yaser/node-hello-app
    • 3000 port of my laptop to 3001 of container
  • NOTE: if there is error in Dockerfile, the container will not create;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment