Collecting random docker files I've used/created
- Basic file:
FROM (image), ARG (custom arguments), RUN (install packages)
ARG DEBIAN_FRONTEND=noninteractive
is useful for ignoring additional (non-breaking) prompts from the installation of packages&& rm -rf /var/lib/apt/lists/*
is useful for cleaning up, making the image as small as possible- Google
useradd
to remember how to add non-root users to images, and then useUSER <new user>
to use it \ &&
for chaining commands across lines- To pull an image from the repo:
docker pull [OPTIONS] NAME[: TAG|@DIGEST]
- To run an image, adding arguments to run over the top:
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
- List all containers:
docker ps [OPTIONS] (-all)
- stop/kill an image:
docker stop/kill [OPTIONS] CONTAINER [CONTAINER...]
- Remove docker options:
-f
forces it,-v
also removes volumes - Starting an image:
-a
to add a stdout,-i
for interactive mode.
Other bits whilst building:
- Installing R packages using
apt-get install <package>
is much quicker - Add
--platform="linux/amd64"
to the cli when building on a mac
The Rocker Project - Docker Containers for the R Environment
Dockerfiler - create docker file from R
r2u is amazing as it allows all CRAN and many bioconductor packages to be installed via apt