Arquisoft / radarin_en3a

2 stars 1 forks source link

Docker research #33

Closed UO225811 closed 3 years ago

UO225811 commented 3 years ago

There are many public images such as mongo, sql, java, etc.

We can install i.e an Ubuntu os and then install more software to create a custom image.

Docker shares resources with the OS of the pc that is executing its containers.

image

Docker works with os images that can be shared among several applications. It isolates apps but not entire operating systems taking the resources as needed (betther that wasting memory on preassigned vm's).

Download: https://docs.docker.com/get-docker/

Docker hub: you can search the desired image to download there: https://hub.docker.com/

docker pull ubuntu --> downloads the ubuntu image docker pull ubuntu:16.04 --> downloads the image of that precise version

docker run hello-world --> creates a container with the "hello-world" image

Commands:

Docker run --name ubuntubash -i -t ubuntu bash

- --name: gives a name to the container
- -i: an execution of an interactive container
- -t: opens a new terminal tty
- ubuntu: image  to run
- bash: command to execute

Exit from a docker container without removing it: Ctrl-p + ctrl-q

Inside a container, exit command terminates and removes the container

Docker images --> shows all the created images

Create custom images:

Dockerfile

File that creates a customized docker image by creating a file specifying everything on it.

Dockerfile creation:

FROM ubuntu:18.04 --> image to intall

RUN apt -y update RUN apt -y upgrade RUN apt -y intall vim apache

docker build -t "imageExample" . -t --> name . --> path