WHAT IS A CONTAINER?
DevOps@RajeshKumar.XYZ
If you already know how to use software, then you already understand Docker
What are the biggest challenges you face using software?
Traditional Software | Docker Equivalent | Docker Command |
---|---|---|
Find software | DockerHub | |
Download software,i.e. a zip file or MSI | Pullan image | docker pull |
Install software | Create a container froman image | docker create |
Start software | Run the container | dockerstart |
Stop software | Stop the container | dockerstop |
Uninstall software | Removethe container | dockerrm |
NotPossible | Do all of this with one command! | dockerrun |
Use software without knowing how to set it up.
When ready, everything is consistently documented for you to learn how to set it up (Dockerfile).Inverted learning
(for now)
The machine that you run containers upon.
Run Software with a Consistent Command
Share Host Files with Container Processes
dockerrun -d -p 8080:80 --name nginxnginx
docker cp.\app\. nginx:/usr/share/nginx/html
docker commit nginx solitaire:nginx
Dockerfile
FROM nginx
COPY app /usr/share/nginx/html
dockerbuild –t solitaire:nginx.
dockerrun --name db`
-d `
-p 3306:3306 `
-e MYSQL_ROOT_PASSWORD=my-secret-pw `
-v db:/var/lib/mysql`
mysql
dockerinspect db# extract ipaddress
dockerrun --name web `
-d `
-p 8080:80 `
-e MY_DB_PORT=3306 `
-e MY_DB_HOST=? `
-v /my/php/app:/usr/share/nginx/html `
nginx
dockerrun --name db-d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=my-secret-pw -v db:/var/lib/mysqlmysql dockerinspect db# extract ipaddress dockerrun --name web -d -p 8080:80 -e MY_DB_PORT=3306 -e MY_DB_HOST=? -v /my/php/app:/usr/share/nginx/html nginx
version: ‘2’
services:
db:
image: mysql
ports:
-3306:3306
environment:
-MYSQL_ROOT_PASSWORD=my-secret-pw
volumes:
-db:/var/lib/mysql
web:
image: nginx
ports:
-8080:80
environment:
-MY_DB_PORT=3306
-MY_DB_HOST=db
volumes:
-/my/php/app:/usr/share/nginx/html