Skip to content

Docker Note

basics#

  • 2022-01-15
  • Official Guide
  • For run docker with Node JS
  • Docker has
    • dockerfile
    • image: defined by a dockerfile
      • name
      • tag: like a version number
      • is an immutable file
      • instantiate to a new container with docker build
    • container: the sandbox I called
    • CLI
      • docker ps show running containers -a flag to show all containers.
      • docker run run image in a new container: -it flag makes it interactive.
      • docker image #TODO
      • docker tag rename image
    • docker-compose #TODO
  • Using command line / terminal
    • override CMD
    • run ubuntu in docker docker run -it ubuntu (create a new container from image)
    • "run linux command in docker" not working

dockerfile#

New Ubuntu Image#

  • @2022-01-17
  • Should move to Linux Note?
1
2
docker build . --tag ubuntu-test # build once to get an image
docker run -it --name goal ubuntu-test

Ubuntu New user#

  • @2022-01-17
  • Should move to Linux Note?
1
2
adduser USERNAME
usermod -aG sudo USERNAME

Ubuntu tools for Docket image#

  • 2022-01-17
  • add wget and curl: apt-get install wget curl

Continue Docker image Shell#

  • 2022-01-17
1
docker start -i $DOCKER_NAME