you can install docker manually by downloading
Download Docker for windows Download Docker for Ubuntuif you have downloaded the .deb package for ubuntu then run the following command :
sudo dpkg -i /path/to/package.deb
you can install docker on linux using following command
apt-get update
sudo apt-get install docker.io
OR refer to the documentation here
Then you can verify your installation by the following commands :
docker --version
docker info
following command is used to run a test container with a default hello world image :
sudo docker run hello-world
Some basic operations like starting ,stoping ,listing containers
docker pull aamirpinger/helloworld
docker images
OR
docker image ls
docker run -d aamirpinger/helloworld
OR
docker run --name <container name> -d -p<port ex= 9000:80> aamirpinger/helloworld
docker run -it aamirpinger/helloworld:<tag> sh
OR
docker run --name <container name> -it -p<port ex= 9000:80> aamirpinger/helloworld sh
exit
ctrl + p + q
docker exec -it <container name or id> sh
gets list of runnung containers
docker ps
OR
docker container ls
gets list of all containers
docker ps -a
OR
docker container ls -a
Start an existing container
docker start <container name or id>
Stop an existing container
docker stop <container name or id>
docker container rm <container name or id>
Built a simple html page image that we can run using docker.
FROM nginx:alpine
COPY . /usr/share/nginx/html
COPY . is used to copy all files present in the current folder to the destination folder in the image that is to be created.
Next we need to specific where to paste the files in image environment /usr/share/nginx/html (destination folder in the image).
Make sure you are in the same folder that you created
docker image build -t <image name>:<tag> .
here "." represents that Dockerfile is in the current directory, if Dockerfile is not in the same directory then you can write the path to Dockerfile
First make sure you have created the image you want to push.
then if you haven't created account and repo in docker hub follow the link and register an account and make a repo(repositry)
docker login --username <username on docker hub>
now it will ask for your docker hub password type the password and hit enter.
first copy the image id of your image
docker images
now tag the image using the following command
docker tag <image id> <hub username>/<repo name>:<tag>
docker push <hub username>/<repo name>:<tag>