0% found this document useful (0 votes)
9 views

Introduccion a Docker 4

The document provides instructions on using Docker to pull and run Tomcat and MongoDB containers, including commands for managing volumes, logs, and images. It also includes steps for building custom Docker images using Dockerfiles and running Java applications. Additionally, it mentions downloading a WAR file and using Robot 3T for MongoDB management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Introduccion a Docker 4

The document provides instructions on using Docker to pull and run Tomcat and MongoDB containers, including commands for managing volumes, logs, and images. It also includes steps for building custom Docker images using Dockerfiles and running Java applications. Additionally, it mentions downloading a WAR file and using Robot 3T for MongoDB management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Volumenes

$ docker pull tomcat

$ docker run -it --name mytomcat -p 8080:8080 -v /home/ec2-


user/webapps/:/usr/local/tomcat/webapps/ tomcat

• Trabajando con volúmenes


• Descargue este war y copiar en la su volumen
• wget https://eafit-arq-evo.s3.amazonaws.com/demoHa.war
Docker logs
Docker logs

## Iniciar contenedor

docker start mytomcat

## Ver los logs de un contenedor

docker logs -f mytomcat


Docker Images
Construcción de Images

DockerFile

Image Run Container


Build

Operating System
Software
Application Code
Dockerfile

$ sudo su
• Dockerfile
$ docker build -t tomcatmod .

$ docker images

$ docker run -it --name mytomcat tomcatmod

$ docker ps -a

$ docker rm mytomcat

$ docker rmi tomcatmod


ADD and COPY

$ wget https://eafit-arq-evo.s3.amazonaws.com/demoHa.war

$ docker build -t tomcat-pg-demoha .

$ docker run -it --name mytomcat-pg-demoha -p 8888:8080 tomcat-pg-demoha

$ docker start mytomcat-pg-demoha

$ docker logs -f mytomcat-pg-demoha

$ docker stop mytomcat-pg-demoha


RUN

$ docker build -t ubuntujava .

$ docker run -it --name myubuntujava ubuntujava

$ javac –versión

$ echo $JAVA_HOME
MongoDB Lab
Docker MongoDB

• Creación de un contenedor con MongoDB


• Descargue Robot 3T
• https://robomongo.org/

docker pull mongo

docker run -d --name mongodb -p 27017-27019:27017-27019 mongo

docker run -d --name mongodb -p 27017-27019:27017-27019 -e


MONGO_INITDB_ROOT_USERNAME=mongoadmin -e MONGO_INITDB_ROOT_PASSWORD=mongo mongo

docker exec -it mongodb bash

You might also like