Skip to content

Instantly share code, notes, and snippets.

@betray32
Last active October 8, 2019 03:22
Show Gist options
  • Save betray32/6a9423d597d6d83cae8b77b65dca982d to your computer and use it in GitHub Desktop.
Save betray32/6a9423d597d6d83cae8b77b65dca982d to your computer and use it in GitHub Desktop.
Ejemplos con docker
docker run \
--rm \
-u root \
-p 8080:8080 \
-v "$PWD":/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkinsci/blueocean
Obtener IP del contenedor:
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' id_contenedor
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
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'
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