Last active
October 8, 2019 03:22
-
-
Save betray32/6a9423d597d6d83cae8b77b65dca982d to your computer and use it in GitHub Desktop.
Ejemplos con docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run \ | |
--rm \ | |
-u root \ | |
-p 8080:8080 \ | |
-v "$PWD":/var/jenkins_home \ | |
-v /var/run/docker.sock:/var/run/docker.sock \ | |
jenkinsci/blueocean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Obtener IP del contenedor: | |
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' id_contenedor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Testing con Oracle | |
docker run -d -p 1521:1521 --name oracle-xe paklei/oracle-11g-tester | |
Podemos conectarnos a nuestro docker con la siguiente configuración: | |
# datasource docker local | |
spring.datasource.url=jdbc:oracle:thin:@[IP_CONTENEDOR]/xe | |
spring.datasource.username=tester | |
spring.datasource.password=tester | |
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker network create --driver bridge postgres-network | |
docker run --name postgres1 --network postgres-network -e POSTGRES_PASSWORD=1q2w3e -d postgres | |
docker run -it --rm --network postgres-network postgres psql -h postgres1 -U postgres | |
Check user: select * from pg_user; | |
Obtener la base de datos usada: | |
SELECT | |
pid | |
,datname | |
,usename | |
,application_name | |
,client_hostname | |
,client_port | |
,backend_start | |
,query_start | |
,query | |
,state | |
FROM pg_stat_activity | |
WHERE state = 'active' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Descargar la instancia: | |
docker run -d -p 33060:3306 --name mysql-db -e MYSQL_ROOT_PASSWORD=secret mysql | |
Conectarse, la password es "secret" | |
docker exec -it mysql-db mysql -p | |
Notas: Para conectarse con un cliente, el usuario por defecto es "root" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment