minaremeli / MOON

MOON reproducibility study
0 stars 0 forks source link

Research Dockerization #1

Closed minaremeli closed 2 years ago

minaremeli commented 2 years ago

We want to use Docker to deploy and run experiments on any cloud platform quickly, and seamlessly.

minaremeli commented 2 years ago

About Docker

Docker is a virtualization service for applications. However, virtualization (compared to VM's) is not OS-level, but application level. This means that it does not create a new OS layer just for itself, it shares the underlying OS kernel with (possibly many) other containerized applications. There is some isolation, for example all containers have their own storage, network interfaces and isolated processes.

image

Some Lingo

Container images: Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings. Container: Container images become containers at runtime.

Getting started

Get Docker Desktop here. More info about basic usage of Docker can be found in their docs.

Dockerfile

Docker builds images automatically by reading the instructions from a Dockerfile -- a text file that contains all commands, in order, needed to build a given image. A Dockerfile adheres to a specific format and set of instructions which you can find at Dockerfile reference.

An example Dockerfile:

# syntax=docker/dockerfile:1
FROM ubuntu:18.04
COPY . /app
RUN make /app
CMD python /app/app.py

Each instruction creates one layer:

docker build

The docker build command builds Docker images from a Dockerfile and a “context”. A build’s context is the set of files located in the specified PATH or URL. When the URL parameter points to the location of a Git repository, the repository acts as the build context.

docker images

The default docker images will show all top level images, their repository and tags, and their size.

docker run

The docker run command first creates a writeable container layer over the specified image, and then starts it using the specified command.

Example:

docker run --name test -it debian

This example runs a container named test using the debian:latest image. The -it instructs Docker to allocate a pseudo-TTY connected to the container’s stdin; creating an interactive bash shell in the container. This lets us interact with the container from our terminal.

docker ps -a

Show all containers (default shows just running). (more)

docker stop

Stop one or more running containers. (more)

docker restart

Restart one or more containers. (more)

docker exec

The docker exec command runs a new command in a running container.

minaremeli commented 2 years ago

Old issue, closing.