{"id":860,"date":"2020-03-09T22:52:52","date_gmt":"2020-03-10T03:52:52","guid":{"rendered":"http:\/\/zewwy.ca\/?p=860"},"modified":"2020-03-16T19:31:33","modified_gmt":"2020-03-17T00:31:33","slug":"belk-stack-on-docker-part-1-docker","status":"publish","type":"post","link":"https:\/\/zewwy.ca\/index.php\/2020\/03\/09\/belk-stack-on-docker-part-1-docker\/","title":{"rendered":"BELK Stack on Docker <\/br>(Part 1 \u2013 Docker)"},"content":{"rendered":"<h1><img decoding=\"async\" src=\"https:\/\/i.imgur.com\/lemvvCl.png\" \/><\/h1>\n<h1 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"The_Story\"><\/span><strong>The Story<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>This time our goal to setup a SEIM (Security Event &amp; Information Monitoring) which will gather data via the BELK Stak (Beat, Elasticsearch, Logstash and Kibana). This is going to take (I&#8217;m assuming, as I&#8217;ve just started) about 4-5 separate blog posts to get this off the ground.<\/p>\n<p>It has taken me a couple weeks of smashing my head into a wall simply due to my own ignorance, so in this blog series I&#8217;m going to cover more step-by-step exactly what needs to be done for my particular setup. There are many ways you can configure services these days, which still includes bare metal. If I so chose I could run Docker on a bare metal Ubuntu server, or even a bare metal windows server, but in this case I&#8217;m going to install docker on a Ubuntu server which will happen to be itself a VM (Virtual Machine).<\/p>\n<p>Now with that in mind, <a href=\"https:\/\/itnext.io\/docker-101-fundamentals-the-dockerfile-b33b59d0f14b\">here&#8217;s some basic reading you<\/a> probably <a href=\"https:\/\/www.techrepublic.com\/article\/how-to-use-dockerfiles\/\">should do before<\/a> continuing on. Now before we go on let&#8217;s be clear on one thing, docker itself doesn&#8217;t run on magic, or fluffly rainbow clouds, as I mentioned in the paragraph above it runs on some system, whether that&#8217;s again bare metal or some VM of some kind [Think IaaS (Infrastructure as a Service)], in this blog it will be a Ubuntu VM. The specs of this machine should suffice for the application and workloads that are going to be created on it.<\/p>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Dockerfile_Commands\"><\/span>Dockerfile Commands<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Below, are the commands that will be used 90% of the time when you\u2019re writing Dockerfiles, and what they mean.<\/p>\n<p>FROM \u2014 this initializes a new build stage and sets the Base Image for subsequent instructions. As such, a valid Dockerfile must start with a FROM instruction.<\/p>\n<p>RUN \u2014 will execute any commands in a new layer on top of the current image and commit the results. The resulting committed image will be used for the next step in the Dockerfile.<\/p>\n<p>ENV \u2014 sets the environment variable &lt;key&gt; to the value &lt;value&gt;. This value will be in the environment for all subsequent instructions in the build stage and can be replaced inline in many as well.<\/p>\n<p>EXPOSE \u2014 informs Docker that the container listens on the specified network ports at runtime. You can specify whether the port listens on TCP or UDP, and the default is TCP if the protocol is not specified. This makes it possible for the host and the outside world to access the isolated Docker Container<\/p>\n<p>VOLUME \u2014 creates a mount point with the specified name and marks it as holding externally mounted volumes from the native host or other containers.<\/p>\n<p>You do not have to use every command. In fact, I am going to demonstrate a Dockerfile using only FROM, MAINTAINER, and RUN.<\/p>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Images_vs_Containers\"><\/span>Images vs. Containers<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The terms Docker image and Docker container are sometimes used interchangeably, but they shouldn\u2019t be, they mean two different things.<br \/>\nDocker images are executable packages that include everything needed to run an application \u2014 the code, a runtime, libraries, environment variables, and configuration files.<br \/>\nDocker containers are a runtime instance of an image \u2014 what the image becomes in memory when executed (that is, an image with state, or a user process).<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/i.imgur.com\/z7ACom8.png\" \/><\/p>\n<p>Examples of Docker containers. Each one comes from a specific Docker image.<br \/>\nIn short, Docker images hold the snapshot of the Dockerfile, and the Docker container is a running implementation of a Docker image based on the instructions contained within that image.<\/p>\n<p>This is true, however this image is a bit misleading as it&#8217;s missing the versioning which will become apparent a bit later  on in this blog post.<\/p>\n<h2 id=\"3175\" class=\"ic id dw at as ie if ig ih ii ij ik il im in io ip\" style=\"text-align: center;\" data-selectable-paragraph=\"\"><span class=\"ez-toc-section\" id=\"Docker_Engine_Commands\"><\/span>Docker Engine Commands<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p id=\"f5cf\" class=\"hg hh dw at hi b hj iq hl ir hn is hp it hr iu ht do\" data-selectable-paragraph=\"\">Once the Dockerfile has been written the Docker image can be built and the Docker container can be run. All of this is taken care of by the Docker Engine that I covered briefly earlier.<\/p>\n<p id=\"5e6e\" class=\"hg hh dw at hi b hj hk hl hm hn ho hp hq hr hs ht do\" data-selectable-paragraph=\"\">A user can interact with the Docker Engine through the Docker CLI, which talks to the Docker REST API, which talks to the long-running Docker daemon process (the heart of the Docker Engine). Here\u2019s an illustration below.<\/p>\n<figure class=\"gn go gp gq gr gs de df paragraph-image\">\n<div class=\"de df kg\">\n<div class=\"gy r gz ha\">\n<div class=\"kh r\"><img loading=\"lazy\" decoding=\"async\" class=\"oa tm dj t u gv ak hf\" role=\"presentation\" src=\"https:\/\/miro.medium.com\/max\/492\/1*MYX0ClbWoitxS0RNUVvj8A.png\" width=\"492\" height=\"385\" \/><\/div>\n<\/div>\n<\/div><figcaption class=\"ax ez jj jk jl dg de df jm jn as cn\" data-selectable-paragraph=\"\">The CLI uses the Docker REST API to control or interact with the Docker daemon through scripting or direct CLI commands. Many other Docker applications use the underlying API and CLI as well.<\/figcaption><\/figure>\n<p id=\"4c1e\" class=\"hg hh dw at hi b hj hk hl hm hn ho hp hq hr hs ht do\" data-selectable-paragraph=\"\">Here are the commands you\u2019ll be running from the command line the vast majority of the time you\u2019re using individual Dockerfiles.<\/p>\n<ul class=\"\">\n<li id=\"b8f3\" class=\"hg hh dw at hi b hj hk hl hm hn ho hp hq hr hs ht hu hv hw\" data-selectable-paragraph=\"\"><code class=\"ha jd je jf jg b\">docker build<\/code> \u2014 builds an image from a Dockerfile<\/li>\n<li id=\"3206\" class=\"hg hh dw at hi b hj hx hl hy hn hz hp ia hr ib ht hu hv hw\" data-selectable-paragraph=\"\"><code class=\"ha jd je jf jg b\">docker images<\/code> \u2014 displays all Docker images on that machine<\/li>\n<li id=\"d788\" class=\"hg hh dw at hi b hj hx hl hy hn hz hp ia hr ib ht hu hv hw\" data-selectable-paragraph=\"\"><code class=\"ha jd je jf jg b\">docker run<\/code> \u2014 starts container and runs any commands in that container<\/li>\n<li id=\"b2a8\" class=\"hg hh dw at hi b hj hx hl hy hn hz hp ia hr ib ht hu hv hw\" data-selectable-paragraph=\"\">there\u2019s multiple options that go along with <code class=\"ha jd je jf jg b\">docker run<\/code> including<\/li>\n<li id=\"6fe9\" class=\"hg hh dw at hi b hj hx hl hy hn hz hp ia hr ib ht hu hv hw\" data-selectable-paragraph=\"\"><code class=\"ha jd je jf jg b\">-p<\/code> \u2014 allows you to specify ports in host and Docker container<\/li>\n<li id=\"eac7\" class=\"hg hh dw at hi b hj hx hl hy hn hz hp ia hr ib ht hu hv hw\" data-selectable-paragraph=\"\"><code class=\"ha jd je jf jg b\">-it<\/code>\u2014opens up an interactive terminal after the container starts running<\/li>\n<li id=\"3746\" class=\"hg hh dw at hi b hj hx hl hy hn hz hp ia hr ib ht hu hv hw\" data-selectable-paragraph=\"\"><code class=\"ha jd je jf jg b\">-v<\/code> \u2014 bind mount a volume to the container<\/li>\n<li id=\"cbc8\" class=\"hg hh dw at hi b hj hx hl hy hn hz hp ia hr ib ht hu hv hw\" data-selectable-paragraph=\"\"><code class=\"ha jd je jf jg b\">-e<\/code> \u2014 set environmental variables<\/li>\n<li id=\"ab51\" class=\"hg hh dw at hi b hj hx hl hy hn hz hp ia hr ib ht hu hv hw\" data-selectable-paragraph=\"\"><code class=\"ha jd je jf jg b\">-d<\/code> \u2014 starts the container in daemon mode (it runs in a background process)<\/li>\n<li id=\"4f5d\" class=\"hg hh dw at hi b hj hx hl hy hn hz hp ia hr ib ht hu hv hw\" data-selectable-paragraph=\"\"><code class=\"ha jd je jf jg b\">docker rmi<\/code> \u2014 removes one or more images<\/li>\n<li id=\"cc0a\" class=\"hg hh dw at hi b hj hx hl hy hn hz hp ia hr ib ht hu hv hw\" data-selectable-paragraph=\"\"><code class=\"ha jd je jf jg b\">docker rm<\/code> \u2014 removes one or more containers<\/li>\n<li id=\"7b3a\" class=\"hg hh dw at hi b hj hx hl hy hn hz hp ia hr ib ht hu hv hw\" data-selectable-paragraph=\"\"><code class=\"ha jd je jf jg b\">docker kill<\/code> \u2014 kills one or more running containers<\/li>\n<li id=\"5d11\" class=\"hg hh dw at hi b hj hx hl hy hn hz hp ia hr ib ht hu hv hw\" data-selectable-paragraph=\"\"><code class=\"ha jd je jf jg b\">docker ps<\/code> \u2014 displays a list of running containers<\/li>\n<li id=\"1a1e\" class=\"hg hh dw at hi b hj hx hl hy hn hz hp ia hr ib ht hu hv hw\" data-selectable-paragraph=\"\"><code class=\"ha jd je jf jg b\">docker tag<\/code> \u2014 tags the image with an alias that can be referenced later (good for versioning)<\/li>\n<li id=\"4725\" class=\"hg hh dw at hi b hj hx hl hy hn hz hp ia hr ib ht hu hv hw\" data-selectable-paragraph=\"\"><code class=\"ha jd je jf jg b\">docker login<\/code> \u2014 login to Docker registry<\/li>\n<\/ul>\n<p>A big thank you to: Paige Niedringhaus for her contributions you can see most of this theory content was a direct copy paste, but not all the content just the basic relevant ones (in case the source material ever goes down).<\/p>\n<p>Now that we got the theory out of the way, let&#8217;s get down to the practical fun!<\/p>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Installing_Docker\"><\/span>Installing Docker<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>https:\/\/docs.docker.com\/install\/linux\/docker-ce\/ubuntu\/<\/p>\n<h3 id=\"uninstall-old-versions\" style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Uninstall_old_versions%F0%9F%94%97\"><\/span>Uninstall old versions<a class=\"anchorLink\" href=\"https:\/\/docs.docker.com\/install\/linux\/docker-ce\/ubuntu\/#uninstall-old-versions\">\ud83d\udd17<\/a><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Older versions of Docker were called <code class=\"highlighter-rouge\">docker<\/code>, <code class=\"highlighter-rouge\">docker.io<\/code>, or <code class=\"highlighter-rouge\">docker-engine<\/code>. If these are installed, uninstall them:<\/p>\n<div class=\"language-bash highlighter-rouge\">\n<div class=\"highlight\">\n<pre class=\"highlight\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">sudo <\/span>apt-get remove docker docker-engine docker.io containerd runc\r\n<\/code><\/pre>\n<\/div>\n<\/div>\n<p>It\u2019s OK if <code class=\"highlighter-rouge\">apt-get<\/code> reports that none of these packages are installed.<\/p>\n<h3 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Installing_Dependencies\"><\/span>Installing Dependencies<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Don&#8217;t got non moving on&#8230;<\/p>\n<pre class=\"highlight\"><code><span class=\"nb\">sudo <\/span>apt-get install <span class=\"se\">\\<\/span>\r\n    apt-transport-https <span class=\"se\">\\<\/span>\r\n    ca-certificates <span class=\"se\">\\<\/span>\r\n    curl <span class=\"se\">\\<\/span>\r\n    gnupg-agent <span class=\"se\">\\<\/span>\r\n    software-properties-common<\/code><\/pre>\n<p><a href=\"https:\/\/i.imgur.com\/otboWjw.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/otboWjw.png\" alt=\"\" width=\"891\" height=\"305\" \/><\/a><\/p>\n<pre class=\"highlight\"><code>curl <span class=\"nt\">-fsSL<\/span> https:\/\/download.docker.com\/linux\/ubuntu\/gpg | <span class=\"nb\">sudo <\/span>apt-key add -<\/code><\/pre>\n<p><a href=\"https:\/\/i.imgur.com\/KojXV9K.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/KojXV9K.png\" alt=\"\" width=\"713\" height=\"35\" \/><\/a><\/p>\n<pre class=\"highlight\"><code>apt-key fingerprint 0EBFCD88<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/i.imgur.com\/sHjhe1T.png\" \/><\/p>\n<pre class=\"highlight\"><code><span class=\"nb\">sudo <\/span>add-apt-repository <span class=\"se\">\\<\/span>\r\n   <span class=\"s2\">\"deb [arch=amd64] https:\/\/download.docker.com\/linux\/ubuntu <\/span><span class=\"se\">\\<\/span>\r\n   <span class=\"k\">$(<\/span>lsb_release <span class=\"nt\">-cs<\/span><span class=\"k\">)<\/span> <span class=\"se\">\\<\/span><span class=\"s2\">\r\n   stable\"<\/span><\/code><\/pre>\n<p><a href=\"https:\/\/i.imgur.com\/SfL65Yp.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/SfL65Yp.png\" alt=\"\" width=\"964\" height=\"147\" \/><\/a><\/p>\n<h3 id=\"install-docker-engine---community-1\" style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Install_Docker_Engine_%E2%80%93_Community\"><\/span>Install Docker Engine &#8211; Community<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Update the apt package index.<\/p>\n<pre>sudo apt-get update<\/pre>\n<p>Install the latest version of Docker Engine &#8211; Community and containerd, or go to the next step to install a specific version:<\/p>\n<pre>sudo apt-get install docker-ce docker-ce-cli containerd.io<\/pre>\n<p>Got multiple Docker repositories?<\/p>\n<p>If you have multiple Docker repositories enabled, installing or updating without specifying a version in the apt-get install or apt-get update command always installs the highest possible version, which may not be appropriate for your stability needs.<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/XB6Y6wI.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/XB6Y6wI.png\" alt=\"\" width=\"747\" height=\"558\" \/><\/a><\/p>\n<p>To install a specific version of Docker Engine &#8211; Community, list the available versions in the repo, then select and install:<\/p>\n<p>List the versions available in your repo:<\/p>\n<pre>apt-cache madison docker-ce<\/pre>\n<pre>docker-ce | 5:18.09.1~3-0~ubuntu-xenial | https:\/\/download.docker.com\/linux\/ubuntu xenial\/stable amd64 Packages\r\ndocker-ce | 5:18.09.0~3-0~ubuntu-xenial | https:\/\/download.docker.com\/linux\/ubuntu xenial\/stable amd64 Packages\r\ndocker-ce | 18.06.1~ce~3-0~ubuntu | https:\/\/download.docker.com\/linux\/ubuntu xenial\/stable amd64 Packages\r\ndocker-ce | 18.06.0~ce~3-0~ubuntu | https:\/\/download.docker.com\/linux\/ubuntu xenial\/stable amd64 Packages\r\n...\r\nb. Install a specific version using the version string from the second column, for example, 5:18.09.1~3-0~ubuntu-xenial.<\/pre>\n<pre>sudo apt-get install docker-ce=&lt;VERSION_STRING&gt; docker-ce-cli=&lt;VERSION_STRING&gt; containerd.io<\/pre>\n<p>Verify that Docker Engine &#8211; Community is installed correctly by running the hello-world image.<\/p>\n<pre>sudo docker run hello-world<\/pre>\n<p><a href=\"https:\/\/i.imgur.com\/z5AqCX9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/z5AqCX9.png\" alt=\"\" width=\"1025\" height=\"329\" \/><\/a><\/p>\n<p><a href=\"https:\/\/i.imgur.com\/Eyfk6PG.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/Eyfk6PG.png\" alt=\"\" width=\"650\" height=\"455\" \/><\/a><\/p>\n<p>Woooo, what a lot of fun&#8230;. Just note one thing here&#8230;<\/p>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Executing_the_Docker_Command_Without_Sudo_Optional\"><\/span>Executing the Docker Command Without Sudo (Optional)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>By default, the docker command can only be run the root user or by a user in the docker group, which is automatically created during Docker\u2019s installation process. If you attempt to run the docker command without prefixing it with sudo or without being in the docker group, you\u2019ll get an output like this:<\/p>\n<pre>docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.\r\nSee 'docker run --help'.<\/pre>\n<p>If you want to avoid typing sudo whenever you run the docker command, add your username to the docker group:<\/p>\n<pre>sudo usermod -aG docker ${USER}<\/pre>\n<p>To apply the new group membership, log out of the server and back in, or type the following:<\/p>\n<pre>su - ${USER}<\/pre>\n<p>You will be prompted to enter your user\u2019s password to continue.<\/p>\n<p>Confirm that your user is now added to the docker group by typing:<\/p>\n<pre>id -nG<\/pre>\n<p>If you need to add a user to the docker group that you\u2019re not logged in as, declare that username explicitly using:<\/p>\n<pre>sudo usermod -aG docker username<\/pre>\n<p>The rest of this article assumes you are running the docker command as a user in the docker group. If you choose not to, please prepend the commands with sudo.<\/p>\n<p>Let\u2019s explore the docker command next. <a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-install-and-use-docker-on-ubuntu-18-04\">Thanks Brian<\/a><\/p>\n<p><a href=\"https:\/\/i.imgur.com\/PKawpIz.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/PKawpIz.png\" alt=\"\" width=\"674\" height=\"273\" \/><\/a><\/p>\n<p><a href=\"https:\/\/i.imgur.com\/AOhlxxK.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/AOhlxxK.png\" alt=\"\" width=\"684\" height=\"364\" \/><\/a><\/p>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Creating_your_Dockerfile\"><\/span>Creating your Dockerfile<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The first thing we&#8217;re going to do is create a new directory to work within; so open a terminal window and issue the command as root&#8230;<\/p>\n<pre> mkdir \/dockerfiles\r\nchown dadocker:docker \/dockerfiles<\/pre>\n<p>Change into that newly created directory with the command<\/p>\n<pre> cd \/dockerfiles<\/pre>\n<p>Now we create our Dockerfile with the command nano Dockerfile and add the following contents:<\/p>\n<pre>FROM ubuntu:latest\r\nMAINTAINER NAME EMAIL\r\n\r\nRUN apt-get  update &amp;&amp; apt-get -y upgrade &amp;&amp; apt-get install -y nginx<\/pre>\n<p>Where NAME is the name to be used as the maintainer and EMAIL is the maintainer&#8217;s email address.<\/p>\n<p>Save and close that file. (In my case i called it dockerfile; with a lowercase d)<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/L0aAadG.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/L0aAadG.png\" alt=\"\" width=\"621\" height=\"76\" \/><\/a><\/p>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Building_the_Image\"><\/span>Building the Image<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Now we build an image from our Dockerfile. This is run with the command (by a user in the docker group):<\/p>\n<pre>docker build -t \"NAME:Dockerfile\" .<\/pre>\n<p>Where NAME is the name of the image to be built.<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/D9ycyCV.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/D9ycyCV.png\" alt=\"\" width=\"669\" height=\"195\" \/><\/a><\/p>\n<p>in this case . simply represents the local directory, else specify the path of the file&#8230;<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/3HInKKU.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/3HInKKU.png\" alt=\"\" width=\"651\" height=\"195\" \/><\/a><\/p>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Listing_Images\"><\/span>Listing Images<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre>docker images<\/pre>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Deleting_Images\"><\/span>Deleting Images<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre>docker rmi image:tag<\/pre>\n<p><a href=\"https:\/\/i.imgur.com\/lxynv76.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/lxynv76.png\" alt=\"\" width=\"730\" height=\"258\" \/><\/a><\/p>\n<p><a href=\"https:\/\/i.imgur.com\/NVQiHt0.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/NVQiHt0.png\" alt=\"\" width=\"849\" height=\"597\" \/><\/a><\/p>\n<h2 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Running_Images_Creating_Containers\"><\/span>Running Images (Creating Containers)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre>docker run image<\/pre>\n<p><a href=\"https:\/\/i.imgur.com\/wGAs8zg.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/wGAs8zg.png\" alt=\"\" width=\"1026\" height=\"147\" \/><\/a><\/p>\n<p>well poop, after running and stopping a container I was unable to delete the images&#8230; <a href=\"https:\/\/stackoverflow.com\/questions\/47011838\/docker-rmi-is-it-okay-to-use-force\">Internets to the rescue<\/a>! since a force seemed rather harsh way to do it.<\/p>\n<p>By default <code>docker ps<\/code> will only show running containers. You can show the stopped ones using <code>docker ps --all<\/code>.<\/p>\n<p>You can then remove the container first with <code>docker rm &lt;CONTAINER_ID&gt;<\/code><\/p>\n<p>If you want to remove all of the containers, stopped or not, you can achieve this from a bash prompt with<\/p>\n<pre><code>$ docker rm $(docker ps --all -q)\r\n<\/code><\/pre>\n<p>The -q switch returns only the IDs<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/sMVwNcf.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/sMVwNcf.png\" alt=\"\" width=\"1018\" height=\"274\" \/><\/a><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/i.imgur.com\/FgjHBUw.png\" \/><\/p>\n<p>yay it worked!<\/p>\n<h1 style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>Most of the time you won&#8217;t be directly installing docker, or building your own images, but if you do you at least now know the basics. These will become import in the future blog posts. I hope this helps with the basic understanding.<\/p>\n<p>In the next blog post I&#8217;ll cover Docker-Compose, which will allow use to spin up multiple images into a single working container which will be the bases of our ELK stack. \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Story This time our goal to setup a SEIM (Security Event &amp; Information Monitoring) which will gather data via the BELK Stak (Beat, Elasticsearch, Logstash and Kibana). This is going to take (I&#8217;m assuming, as I&#8217;ve just started) about 4-5 separate blog posts to get this off the ground. It has taken me a &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/zewwy.ca\/index.php\/2020\/03\/09\/belk-stack-on-docker-part-1-docker\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;BELK Stack on Docker <\/br>(Part 1 \u2013 Docker)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sfsi_plus_gutenberg_text_before_share":"","sfsi_plus_gutenberg_show_text_before_share":"","sfsi_plus_gutenberg_icon_type":"","sfsi_plus_gutenberg_icon_alignemt":"","sfsi_plus_gutenburg_max_per_row":"","footnotes":""},"categories":[8],"tags":[279,280],"class_list":["post-860","post","type-post","status-publish","format-standard","hentry","category-server-administration","tag-containers","tag-docker"],"_links":{"self":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/860","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/comments?post=860"}],"version-history":[{"count":5,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/860\/revisions"}],"predecessor-version":[{"id":871,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/860\/revisions\/871"}],"wp:attachment":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/media?parent=860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/categories?post=860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/tags?post=860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}