Docker: running httpd with SSL

docker run -d -p 443:443 inanimate/httpd-ssl

The more configurable way:

$ docker run -d -e SERVER_NAME=foobar.example.com \
-v /path/to/server.crt:/usr/local/apache2/conf/server.crt \
-v /path/to/server.key:/usr/local/apache2/conf/server.key \
inanimate/httpd-ssl

Note: you can use the –name to specify a docker name for the container

Read More

Oracle: Configure Oracle to be used with SSL

1. Run the docker image with Oracle EE

docker run -t -p 1532:1532 -p 1521:1521 -e ORACLE_SID=APP -e ORACLE_PWD=pswd -v /local/docker/mounts/oracle:/opt/oracle/oradata oracle/database:12.1.0.2-ee 

2. Connected to the instance:

docker exec -it friendly_khorana /bin/bash

3. Create a wallet

orapki wallet create -wallet /opt/oracle/admin/APP/xdb_wallet -pwd WalletPasswd123 -auto_login_local
orapki wallet add -wallet /opt/oracle/admin/APP/xdb_wallet  -pwd WalletPasswd123   -dn "CN=`hostname`" -keysize 1024 -self_signed -validity 3650
orapki wallet display -wallet /opt/oracle/admin/APP/xdb_wallet -pwd WalletPasswd123
orapki wallet export -wallet /opt/oracle/admin/APP/xdb_wallet -pwd WalletPasswd123 -dn "CN=`hostname`" -cert /tmp/`hostname`-certificate.crt

4. Edit configuration

4.1 listener.ora

SSL_CLIENT_AUTHENTICATION = FALSE

WALLET_LOCATION =
  (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
      (DIRECTORY = /opt/oracle/admin/APP/xdb_wallet)
    )
  )

LISTENER =
(DESCRIPTION_LIST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
  )
  (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCPS)(HOST = 0.0.0.0)(PORT = 1532))
   )
)

DEDICATED_THROUGH_BROKER_LISTENER=ON
DIAG_ADR_ENABLED = off

4.2 sqlnet.ora

WALLET_LOCATION =
   (SOURCE =
     (METHOD = FILE)
     (METHOD_DATA =
       (DIRECTORY = /opt/oracle/admin/APP/xdb_wallet)
     )
   )

SQLNET.AUTHENTICATION_SERVICES = (TCPS,NTS,BEQ)
SSL_CLIENT_AUTHENTICATION = FALSE
SSL_CIPHER_SUITES = (SSL_RSA_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA)

4.3 tnsnames.ora

APP=
(DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCPS)(HOST = 0.0.0.0)(PORT = 1532))
  (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = APP)
  )
)

5. Connect with SQLDeveloper

keytool -import -trustcacerts -alias oracle3 -file 15e31b633912-certificate.crt -keystore /u01/keystore/OracleTrustStore.jks

Update SqlDeveloper.conf /Applications/SQLDeveloper.app/Contents/Resources/sqldeveloper/sqldeveloper/bin/sqldeveloper.conf

AddVMOption -Djavax.net.ssl.trustStore=/u01/keystore/OracleTrustStore.jks
AddVMOption -Djavax.net.ssl.trustStorePassword=welcome1234
AddVMOption -Djavax.net.ssl.trustStoreType=JKS
To connect from sqldevloper restart sqldeveloper and use the advanced option in sqldeveloper:
Connection string:

jdbc:oracle:thin:@(DESCRIPTION =  (ADDRESS = (PROTOCOL = TCPS)(HOST = server_ip_addr)(PORT = 1532))(CONNECT_DATA =(SERVER = DEDICATED) (SERVICE_NAME = ORCLCDB)))
Read More

Docker: Run activeMQ and remap ports

Get the latest build:

docker pull webcenter/activemq:latest

Then run the image with the following command:

docker run --name='activemq' -d \
-v /data/activemq:/data \
-v /var/log/activemq:/var/log/activemq \
-p 8162:8161 \
-p 61617:61616 \
-p 61614:61613 \
webcenter/activemq:5.14.3
Read More

Docker cheatsheet

## List Docker CLI commands
docker
docker container --help

## Display Docker version and info
docker --version
docker version
docker info

## Execute Docker image
docker run hello-world

## List Docker images
docker image ls

## List Docker containers (running, all, all in quiet mode)
docker container ls
docker container ls --all
docker container ls -aq


docker build -t friendlyhello .  # Create image using this directory's Dockerfile
docker run -p 4000:80 friendlyhello  # Run "friendlyname" mapping port 4000 to 80
docker run -d -p 4000:80 friendlyhello         # Same thing, but in detached mode
docker container ls                                # List all running containers
docker container ls -a             # List all containers, even those not running
docker container stop <hash>           # Gracefully stop the specified container
docker container kill <hash>         # Force shutdown of the specified container
docker container rm <hash>        # Remove specified container from this machine
docker container rm $(docker container ls -a -q)         # Remove all containers
docker image ls -a                             # List all images on this machine
docker image rm <image id>            # Remove specified image from this machine
docker image rm $(docker image ls -a -q)   # Remove all images from this machine
docker login             # Log in this CLI session using your Docker credentials
docker tag <image> username/repository:tag  # Tag <image> for upload to registry
docker push username/repository:tag            # Upload tagged image to registry
docker run username/repository:tag                   # Run image from a registry

docker stack ls                                            # List stacks or apps
docker stack deploy -c <composefile> <appname>  # Run the specified Compose file
docker service ls                 # List running services associated with an app
docker service ps <service>                  # List tasks associated with an app
docker inspect <task or container>                   # Inspect task or container
docker container ls -q                                      # List container IDs
docker stack rm <appname>                             # Tear down an application
docker swarm leave --force      # Take down a single node swarm from the manager
Read More