Difference between revisions of "Docker"

From neil.tappsville.com
Jump to navigationJump to search
m
m
Line 37: Line 37:
 
RUN make /app
 
RUN make /app
 
CMD python /app/app.py</pre>
 
CMD python /app/app.py</pre>
 +
 +
==Build==
 +
docker build [path/Dockerfilefolder]
 +
-t name:tag

Revision as of 03:55, 23 August 2020

Docker

Containers

List running containers

docker ps

List all containers

docker ps -a

Run a container

docker run [image]
-d detached
-i interactive
-t terminal  (usually -it)
-e VAR=value  (environment variables)
--name name
run:version (using a tag)


Port mapping

-p (host/external):(container/internal)

Directory mapping

-v /host/dir:/container/dir

Inspect (returns json)

docker inspect [container]

Images

List images

docker image ls

Remove image (must have no containers attached)

docker rmi [image]

Dockerfile

Contains Instructions or Arguments

FROM ubuntu:18.04
COPY . /app
RUN make /app
CMD python /app/app.py

Build

docker build [path/Dockerfilefolder]
-t name:tag