Anonymous
×
Create a new article
Write your page title here:
We currently have 27 articles on PhenixOps. Type your article name above or click on one of the titles below and start writing!



PhenixOps
27Articles

Docker: Difference between revisions

No edit summary
No edit summary
 
(20 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Docker First Steps ==
== Docker related info broken down in chapters ==


=== Installation ===
[[ Docker First Steps ]]
<code>
apt-get install -y apt-transport-https ca-certificates surl software-properties-common
</code> <br>


If needed import the docker repo <br>
[[ Building Containerized Applications ]]
<code>
apt-get update 
</code> <br>


Install Docker <br>
[[ Docker Networking ]]
<code>
apt-get install docker-ce
</code> <br>


=== Useful commands ===
[[ Docker Compose ]]


==== Information ====
[[ Scaling ]]
  <br>
<code>
docker info
</code> <br>


==== Check Version of client and server ====
[[Category:Docker]]
<br>
<code>
docker version
</code> <br>
 
==== Search images (usually from hub.docker.com) ====
<br>
<code>
docker search ''image''
</code> <br>
 
==== Get images you want to run ====
  <br>
<code>
docker pull ''image''
</code> <br>
 
==== Show the images ====
<br>
<code>
docker image
</code> <br>
====
Run an image in a container ====
<br>
<code>
docker run ''image''
</code> <br>
====
Stop the container ====
<br>
<code>
docker stop ''image''
</code> <br>
 
==== Start the container ====
<br>
<code>
docker stop ''image''
</code> <br>
 
==== Remove the image ====
<br>
<code>
docker rm ''image''
</code> <br>
 
== Interaction with the Container ==
 
==== Open the bash shell ====
  <br>
<code>
docker exec -it ''image'' /bin bash
</code> <br>
 
== Hello world example ==
==== Search Hello World Image ====
<br>
<code>
docker search ''image''
</code> <br>
 
==== Pull Hello World ====
<br>
<code>
docker pull hello-world
<c/ode> <br>
 
==== Run hello-world ====
<br>
<code>
docker run hello-world
</code> <br>
 
==== Stop Hello World ====
<br>
<code>
docker stop hello-world
</code> <br>
 
==== Get rid of Hello World ====
<br>
<code>
docker rm hello-world
</code> <br>
 
== HTTPD Example ==
==== Run httpd webserver ====
<br>
<code>
docker pull httpd
docker run httpd
</code> <br>
 
==== Run http and expose it to the outside world ====
<br>
<code>
docker run -p 80:80 --name web01 -d httpd
</code> <br>
 
==== Show running containers ====
<br>
<code>
docker ps
</code> <br>
 
==== Get stuff from the webserver ====
<br>
<code>
curl localhost
</code> <br>
 
==== Stop the container ====
<br>
<code>
docker stop web01
</code> <br>
====
Remove the container ====
<br>
<code>
docker rm web01
</code> <br>
 
== Docker Adding Persistance Storage ==
 
This provides the local data to run in the container, for instance the data for the website
====
Expose a folder to the container method 1 ====
<br>
<code>
docker volume create data
</code> <br>
 
<code>
docker run -v /var/www/html:/var/www/ ''httpd''
</code> <br>
====
Expose a folder to the container method 2 ====
<br>
<code>
docker run -d v /var/www/html:/var/www/ ''httpd''
</code> <br>
 
<br>
<code>
docker
</code> <br>
 
<br>
<code>
docker
</code> <br>
 
<br>
<code>
docker
</code> <br>
llll
<br>
<code>
docker
</code> <br>
 
 
 
 
 
=== Comments ===

Latest revision as of 00:13, 25 April 2020