- URLs
- IP addresses
- Localhost VS. public IP addresses/web hosting
- Domain names attach to public IPs
- 80 - is the default port for http://
- 443 - default port for https://
- 22 - default port for ssh 7822
- 3306: for mysql
- 2375/2376 - docker API
(HTTP), subdomains (www)
Tool designed to create, deploy and run applications using containers and images
- Better resource usage
- Images are a fraction of a normal Virtual Machine (VM)
- A slice of a computer
- Containers run only what's in that slice
- Good for Continuous Integration/Continuous Delivery (CI/CD)
- Enables an easy way to host development environments and deploy your app
- Dev, staging/QA (Quality Assurance), production
- Related: Google Cloud Platform, Kubernetes, Amazon Web Services (AWS), Docker Swarm
- "The Cloud": a physical computer, but somewhere else
Images are the blue prints for containers
- Write up a Dockerfile
- Describes the kind of computer slice you want to use
- Describes what to install on that computer slice
- Lists other set up
- Use the Dockerfile to build an image
- Images can be built on other images
- Creates a rubber stamp for your containers
- Is not a running computer
- Use your image to spin up any number of containers
- Running a container from an image uses the image's Dockerfile to spin up a mini computer
- Meant to be ephemeral/short-lived
- Easy to take up and down
- Can be SSH'd into
- Can run an entire application
- Container orchestration
Build the image with your DockerHub username:
docker image build -t <YOUR_USERNAME>/pwp .
-t
allows us to give the image our own name.
refers to where you want to create the image from
docker image ls
docker container run --rm --name pwp -p 80:80 -d <YOUR_USERNAME>/pwp
--rm
means to delete the container when it stops running (default is to be manually removed) *--name
is optional but highly reccommended. Naming a container lets you reference it in commands by name instead of container id.-p 80:80
means to publish Docker's port 80 to your local machine's port 80 (port 80 is the default port for http)-d
means to run in detach mode, or in other words in the background of your terminal
docker container ls
vs docker ps
* I prefer docker container ls
delete a container by either its name or containerId
docker container rm -f name||id
docker image tag username/image-name
- username must be your valid dockerhub username or you will not be able to push to dockerhub
docker container exec command
- exec stands for execute command can be any valid unix command as long as the right arguements are used.
docker container exec –it bash || /bin/sh
-i
stands for interactive-t
Allocate a pseudo-TT TLDR a terminalbash || /bin/sh
bash is not installed in all containers. in case bash is not installed use bin/sh