Docker
- 1 min328 Lecture
Docker
- A leading software container platform
- A set of platform as service product that use OS-level virtualization to deliver software in package called containers.
- A tool designed to easier deploy in docker host and run apps by using containers(from docker images)
- Allows developer to package up an application with all the dependencies.
OS level virtualization
OS allows one or more isolated user space instances —> containers
Containers are isolated from one another and bundle their own software.
Overall picture of the docker workflow
Docker hub —> standard repo / registry
Pros and Cons
Low resources
faster startup
Less traditional
sudo apt update
sudo apt intall docker
For testing
https://labs.play-with-docker.com/
Verify Installation
Run Docker
docker info
docker ps
Getting started
Create dockerfile
text documetn containing commands to assemble custom docker image
Generate Docker image (docker build)
Execute the Image
Running an instance of the image
-
pull image from docker hub
docker pull nginx
-
Check images
docker images
-
Check containers
docker ps -a
-
Run docker container
docker run -d -p 80:80 nginx docker run -d -p 8080:80 --name mycon01 nginx
-
Check locally running instance
http://localhist:8080
Port Binding
Default docker containers make connections to the outside world but the outside world cannot connect to containers
Attatched and Detached Mode
If you want to see all the output of the container, you can use default attach mode
can’t execute any commands , if terminal is attatched with the container
Press(Ctrl+c ) to exit the container
Detached mode
Can run commands if terminal is detached with container