0% found this document useful (0 votes)
63 views2 pages

Docker Help

The document provides a step-by-step guide to install Docker on a Debian system, including necessary packages and repository setup. It covers running Docker containers, managing them, and executing commands within containers. Additionally, it explains how to add a user to the Docker group for easier access and includes examples of running containers in both interactive and daemon modes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views2 pages

Docker Help

The document provides a step-by-step guide to install Docker on a Debian system, including necessary packages and repository setup. It covers running Docker containers, managing them, and executing commands within containers. Additionally, it explains how to add a user to the Docker group for easier access and includes examples of running containers in both interactive and daemon modes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

sudo apt-get install \

apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common

=============================================================================

curl -fsSL [Link] | sudo apt-key add -

=============================================================================

sudo apt-key fingerprint 0EBFCD88

=============================================================================

sudo add-apt-repository \
"deb [arch=amd64] [Link] \
$(lsb_release -cs) \
stable"

=============================================================================

sudo apt-get update

=============================================================================

sudo apt-get install docker-ce docker-compose

=============================================================================

sudo docker run hello-world

=============================================================================

sudo usermod -a -G docker $USER


// above command will add current user to run docker without sudo, restart pc
required

=============================================================================

To apply the new group membership, log out of the server and back in, or type the
following:
su - ${USER}

Run docker in interative mode


-----------------------------
docker run -t -i --name myfirstcontainer ubuntu /bin/bash

=============================================================================

delete docker container


------------------------
docker rum <name or id>

=============================================================================

delete docker image


------------------------
docker rum <name or id>

=============================================================================

Run docker in daemon mode


-----------------------------
docker run -t -d --name MyDaemon ubuntu /bin/bash

stop running docker


--------------------
docker stop <name or id>

start stopped docker


---------------------
docker start <name or id>

Execute command in docker container using API


-------------------------
docker exec <name or id> <command>
docker exec MyDaemon ls

mount host dir to container


--------------------------------------
docker run -t -v /home/deepak/test1/:/var/www/html/ -d --name MyDaemon ubuntu
/bin/bash

example...
docker run -p 80:80 -v /home/deepak/Documents/docker-test/test1/src/:/var/www/html
hello-world

You might also like