no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | linux:software:docker [2022/03/01 13:09] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Docker ====== | ||
+ | <code bash run> | ||
+ | docker run -d --restart=always -p <host port>:< | ||
+ | # run => pull and start in one command | ||
+ | # -d => detach on run | ||
+ | # --restart => always restart the container. Defaults to ' | ||
+ | # -p => publish port | ||
+ | # -v => volume list | ||
+ | # --name => assign a name to the container | ||
+ | </ | ||
+ | |||
+ | <code bash pull + run> | ||
+ | docker pull <image name> | ||
+ | docker pull pengbai/ | ||
+ | docker run -d -p 8765:8080 --name mario pengbai/ | ||
+ | </ | ||
+ | |||
+ | <code bash volumes> | ||
+ | # data in container is reset on container stop | ||
+ | |||
+ | # anonymus volume | ||
+ | docker run -d --restart=always -p <host port>:< | ||
+ | |||
+ | # mount physical directory | ||
+ | docker run -d --restart=always -p <host port>:< | ||
+ | |||
+ | # create a volume and mount it (perferred choice) | ||
+ | docker volume create uptime-kuma | ||
+ | docker run -d --restart=always -p <host port>:< | ||
+ | </ | ||
+ | |||
+ | <code bash basic commands> | ||
+ | # access container shell | ||
+ | docker exec -it 6f7d8322947c bash | ||
+ | |||
+ | # stop container and delete it | ||
+ | docker stop < | ||
+ | docker rm < | ||
+ | |||
+ | # delete local image | ||
+ | docker rmi <image id> | ||
+ | </ | ||
+ | |||
+ | <code docker Dockerfile example> | ||
+ | FROM ubuntu | ||
+ | MAINTAINER Tomislav Plečko, tomislav@plecko.hr | ||
+ | |||
+ | RUN apt update | ||
+ | RUN apt -y install libicu-dev libssl-dev | ||
+ | |||
+ | RUN mkdir /app | ||
+ | COPY Vacation /app | ||
+ | RUN chmod +x /app/dotnet | ||
+ | RUN cd /app | ||
+ | |||
+ | # ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 | ||
+ | |||
+ | WORKDIR /app | ||
+ | |||
+ | CMD ["/ | ||
+ | |||
+ | #ENTRYPOINT /app/dotnet / | ||
+ | </ | ||