Difference between revisions of "Docker"
From neil.tappsville.com
Jump to navigationJump to searchm |
m (→Dockerfile) |
||
Line 35: | Line 35: | ||
<pre>FROM ubuntu:18.04 | <pre>FROM ubuntu:18.04 | ||
COPY . /app | COPY . /app | ||
+ | ADD root/bashrc /root/.bashrc | ||
+ | ENV HOME /root | ||
+ | WORKDIR /root | ||
RUN make /app | RUN make /app | ||
CMD python /app/app.py</pre> | CMD python /app/app.py</pre> |
Revision as of 04:05, 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 ADD root/bashrc /root/.bashrc ENV HOME /root WORKDIR /root RUN make /app CMD python /app/app.py
Build
docker build [path/Dockerfilefolder] -t name:tag