This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For Docker version | |
$ docker --version | |
# For Docker Daemon working check | |
$ docker info | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Need help with docker run command go to | |
# docs.docker.com/engine/reference/commandline/run/ | |
# This will be our host docker | |
$ docker container run -d --privileged -p 80:81 --name docker1 nginx:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# update install packages | |
$ apt update | |
# install a few prerequisite packages | |
$ apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common | |
# add the GPG key for the official Docker repository | |
$ curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - | |
# Docker repository to APT sources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you are not logged into docker hub then | |
# first do login before executing below command | |
$ docker login | |
# Get latest nginx image from Docker Hub | |
$ docker pull nginx:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bash into docker1 | |
docker container exec -it docker1 bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get image pull from docker hub | |
$ docker pull nginx:alpine | |
# Run our second docker - docker2 | |
docker container run -d -p 81:80 --name docker2 nginx:alpine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pull image from docker hub | |
$ docker pull nginx:alpine | |
# Run container from image - docker2 | |
docker container run -d -p 81:80 --name docker2 nginx:alpine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Log into our docker2 container | |
$ docker exec -it docker2 sh | |
# Go to folder | |
cd /usr/share/nginx/html/ | |
# Edit index.html as below | |
$ vi index.html | |
# index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pull image from docker hub - 700MB | |
$ docker pull bhargavshah86/docker:dind | |
# Run Container | |
docker run -d --privileged -p 80:81 --name docker1 bhargavshah/docker:dind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nginx:1.16-alpine | |
LABEL Auther="Bhargav Shah" | |
WORKDIR /usr/share/nginx/html | |
ONBUILD COPY index.html . |
OlderNewer