Docker (software): Difference between revisions

From David's Wiki
Line 69: Line 69:
==Resources==
==Resources==
* [https://www.youtube.com/watch?v=fqMOX6JJhGo freeCodeCamp.org Docker Tutorial for Beginners Video]
* [https://www.youtube.com/watch?v=fqMOX6JJhGo freeCodeCamp.org Docker Tutorial for Beginners Video]
* [https://www.udacity.com/course/scalable-microservices-with-kubernetes--ud615 Scalable Microservices with Kubernetes]
* [https://www.udacity.com/course/scalable-microservices-with-kubernetes--ud615 Scalable Microservices with Kubernetes Udacity Course]
** I haven't watched this but it's by Google so it's probably good.
** I haven't watched this but it's by Google so it's probably good.
** Lessons 1-2 are on Docker and lessons 3-4 are on Kubernetes.
** Lessons 1-2 are on Docker and lessons 3-4 are on Kubernetes.

Revision as of 18:26, 7 August 2020


Installation

Ubuntu

Reference

# Uninstall old docker
sudo apt-get remove docker docker-engine docker.io containerd runc

# Update repos
sudo apt update

# Install prerequisites
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common

# Add official gpg key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

# Add docker repo
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

# Install
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

Windows

  • Upgrade Windows to 2004 or newer
  • Install and enable WSL2
  • Install Docker Desktop

Guides

Get Started

Usage

Images

Containers

docker container ls

Run

docker run <container>
  • -p hostport:containerport to do port forwarding
    • To restrict listing to localhost use -p 127.0.0.1:80:80
  • -it to be interactive with a pseudo-tty

Windows

Notes on using docker with windows

Git bash paths

Reference
When mounting paths using git bash, you need to prepend a / to $(pwd)

Resources