Skip to content

Instantly share code, notes, and snippets.

@danilobrinu

danilobrinu/docker.txt

Last active May 25, 2020
Embed
What would you like to do?
Docker for noobs :v
docker
Old Development
--------------------
| Application Code |
| Dependencies |
| Kernel |
| Hardware |
--------------------
Machine
Application Code -> PA 3.3 (has support for some funcs) x (new machine)
Application Code -> PA 3.7 (new api) x
VM
--------------------
| Application Code |
| Dependencies |
| Kernel |
--------------------
Hardware (8GB RM)
2GB RAM (static) -> 100MB RAM
2GB RAM (static) -> 1GB RAM
2GB RAM (static) -> 0GB RAM
Docker
--------------------
| Application Code |
| Dependencies |
--------------------
Kernel
Hardware
Dockers works using Layers
Dockerfile
----------
FROM ubuntu:18.04
WORKDIR /app
COPY . /app
CMD python app.py
File Structure
--------------
.
| app.py
| requirements.txt
Docker in Layers
-------------
| Container | (R/W)
-------------
|
----------------
| Ubuntu 18.04 | (R/O)
----------------
Dockerfile
----------
FROM fenics:built-by-me
WORKDIR /app
COPY . /app
CMD python3 1abc_fenics.py
File Structure
--------------
.
| 1abc_fenics.py
| requirements.txt
----------------------
-p or --port: puerto expones la aplicacion
-p <machine-port>:<container-port>
-p 8080:8080 (conectar el puerto 8080 del contenedor al puerto 8080 de la maquina - por defecto el host es localhost)
-v or --volume: montar un disco o volumen en el contenedor
-v <machine-path>:<container-path>
-v /home/user/dolphin:/home/fenics/shared
-w or --workdir: espacio de trabajo
docker image structure url
<registry>/<user>/<project>:<tag>
quay.io/fenicsproject/stable:current
-> registry: quay.io
-> user: fenicsproject
-> project: stable
-> tag: current
docker run -ti -p 8000:8000 -v $(pwd):/home/fenics/shared -w /home/fenics/shared quay.io/fenicsproject/stable:current
->
Dockerfile
----------
FROM quay.io/fenicsproject/stable:current
VOLUME $(pwd) /home/fenics/shared
WORKDIR /home/fenics/shared
EXPOSE 8000 8000
PODMAN
------
replace docker by podman
cd /dolphin && podman run -ti -p 8000:8000 -v $(pwd):/home/fenics/shared -w /home/fenics/shared quay.io/fenicsproject/stable:current
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.