linux:software:docker

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>:<container port> -v <volume> --name <container name> <image name>:<optional version>
 +# run => pull and start in one command
 +# -d => detach on run
 +# --restart => always restart the container. Defaults to 'no'
 +# -p => publish port
 +# -v => volume list
 +# --name => assign a name to the container
 +</code>
 +
 +<code bash pull + run>
 +docker pull <image name>
 +docker pull pengbai/docker-supermario
 +docker run -d -p 8765:8080 --name mario pengbai/docker-supermario
 +</code>
 +
 +<code bash volumes>
 +# data in container is reset on container stop
 +
 +# anonymus volume
 +docker run -d --restart=always -p <host port>:<container port> -v /app/data --name uptime-kuma louislam/uptime-kuma:1
 +
 +# mount physical directory
 +docker run -d --restart=always -p <host port>:<container port> -v /home/mount/data:/app/data --name uptime-kuma louislam/uptime-kuma:1
 +
 +# create a volume and mount it (perferred choice)
 +docker volume create uptime-kuma
 +docker run -d --restart=always -p <host port>:<container port> -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1
 +</code>
 +
 +<code bash basic commands>
 +# access container shell
 +docker exec -it 6f7d8322947c bash
 +
 +# stop container and delete it
 +docker stop <container id>
 +docker rm <container id>
 +
 +# delete local image
 +docker rmi <image id>
 +</code>
 +
 +<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 ["/app/dotnet","/app/NoticeVacation.dll","--vacation"]
 +
 +#ENTRYPOINT /app/dotnet /app/NoticeVacation.dll --zulip
 +</code>
  
  • linux/software/docker.txt
  • Last modified: 2022/03/01 13:09
  • by 127.0.0.1