Docker: Difference between revisions

From Bitpost wiki
No edit summary
Line 1: Line 1:
=== Intro ===
=== Setup ===
(Thanks Keith!)
(Thanks Keith!)


<pre><code>
* Install docker
<pre>
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
echo  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update && sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo docker run hello-world
sudo docker container ls -all # to see previous run-and-teardown
sudo usermod -aG docker m # to add m to docker group for complete access, no more need for [sudo docker]
</pre>
* Install a node container.  The official node one is HUGE (1GB), the alpine one is relatively tiny.  See the list [https://hub.docker.com/_/node here.]
<pre>
docker pull node
docker image pull node:current-alpine3.11
# details: https://github.com/nodejs/docker-node/blob/8d77359e4f20c45829f7d7399b76a5eb99eff4da/16/alpine3.11/Dockerfile
docker image ls
docker run -it node
Ctrl-D
docker image ls
</pre>
* Example dockerfile for [https://hub.docker.com/r/linuxserver/nextcloud nextcloud]
* MDMDockerfile attempt one
<pre>
m@matryoshka:~$ cat MDMDockerfile
m@matryoshka:~$ cat MDMDockerfile
FROM node:current-alpine3.11
FROM node:current-alpine3.11

Revision as of 15:50, 16 June 2021

Setup

(Thanks Keith!)

  • Install docker
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
echo   "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update && sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo docker run hello-world
sudo docker container ls -all # to see previous run-and-teardown
sudo usermod -aG docker m # to add m to docker group for complete access, no more need for [sudo docker]
  • Install a node container. The official node one is HUGE (1GB), the alpine one is relatively tiny. See the list here.
docker pull node
docker image pull node:current-alpine3.11
# details: https://github.com/nodejs/docker-node/blob/8d77359e4f20c45829f7d7399b76a5eb99eff4da/16/alpine3.11/Dockerfile
docker image ls
docker run -it node
Ctrl-D
docker image ls
  • Example dockerfile for nextcloud
  • MDMDockerfile attempt one
m@matryoshka:~$ cat MDMDockerfile
FROM node:current-alpine3.11

RUN curl https://install.meteor.com/ | sh
&& mkdir -p development
&& cd development
&& git clone es-platform
&& cd /home/m/development/es-platform
&& meteor npm install
&& cd /home/m/development/es-config/scripts/node/es
&& npm install -g

COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]

CMD [ "es r" ]
</code>

Commands

  • show containers in a nice format
sudo docker ps -a --format "table Template:.Names\tTemplate:.Status" 
sudo docker ps -a --format "table Template:.Names\tTemplate:.Status" |grep #mycontainer#