Quick Docker Installation Guide on Windows for Erik




On Windows, installing two Oracle XE databases at the same time? Forget it – Windows doesn’t like sharing. You always have to pick one version. And if you suddenly want another… well, first you have to say goodbye to the old one (usually accompanied by a few dramatic “why isn’t this working?!”), and then install the new one (often with a few more “oh, come on…” moments). Luckily, Docker steps in like an action hero. Installing a database takes just a moment, removing it is even quicker, and you can have as many different versions as your disk can hold. Yes, literally all the ones you’ve been dreaming of. For the curious and brave and Erik, I’ve prepared a short guide on how to install Docker on Windows – step by step, without pain, tears, or unnecessary drama.

 
No. Step Console / CMD Notes
1 Open CMD
2 Install WSL Oracle Linux 9.5 wsl --install -d OracleLinux_9_5 During installation, provide a username and password
3 Check installed version cat /etc/os-release Information about Oracle Linux 9.5 should be displayed
4 Update packages sudo dnf update -y
sudo dnf upgrade -y
After update, the message "Complete!" should appear
5 Install required tools sudo dnf install -y yum-utils curl After installation, the message "Complete!" should appear
6 Add Docker repository sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo After adding, the message "Complete!" should appear
7 Install Docker sudo dnf install -y docker-ce docker-ce-cli containerd.io
8 Add user to Docker group sudo usermod -aG docker $USER
9 Refresh groups newgrp docker
10* Install nano sudo dnf install nano
11* Edit file and add systemd to /etc/wsl.conf sudo nano /etc/wsl.conf Add to the file:
[boot]
systemd=true
12 Start Docker sudo dockerd > /dev/null 2>&1 &
13 Exit WSL to CMD exit
14 Shut down WSL wsl --shutdown
15 Enter WSL from CMD wsl
16* Enable automatic Docker start  sudo systemctl enable docker
17* Start Docker  sudo systemctl start docker
18 Check if Docker is running docker ps The container list should appear (only headers if no containers are created yet)
*You can use VI instead of nano or other editor
** You can merge 16 and 17 by using sudo systemctl enable --now docker

Oracle XE 18c Database Installation

  1. Open WSL from CMD – command: wsl

  2. Run:

If you want to access the database directories from Windows, create these folders in your Windows directories, e.g., DANE for generated and uploaded files, or TRACE for retrieving trace files.

docker run --name [your_db_name] \
  -v /mnt/[drive]/[windows_dir]:[source_path] \
  -v /mnt/[drive]/[windows_dir]:[source_path] \
  -d -p [windows_port]:1521 \
  -e ORACLE_PASSWORD=[sys_password] \
  gvenzl/oracle-xe:18


Parameters Description
[your_db_name] Database name e.g. db18
[drive]

Drive where you created the folders, without the colon, just the letter, e.g., C

[windows_dir] Windows folder where you map the database directories, e.g., docker_data_db18/oracle_logs
[source_path] Path to the database trace file, e.g., /opt/oracle/diag/rdbms/xe/XE/trace
[windows_port] Port to which the database will be mapped – a high number is recommended, e.g., 21522 (Windows sometimes reserves lower ports)
[sys_password] SYS passwort, e.g.. sys

Example from my installation:

docker run --name db18 \
  -v /mnt/c/docker_data_db18/oracle_logs:/opt/oracle/diag/rdbms/xe/XE/trace \
  -v /mnt/c/docker_data_db18/DATA:/opt/oracle/data \
  -d -p 21522:1521 \
  -e ORACLE_PASSWORD=sys \
  gvenzl/oracle-xe:18

Przydatne komendy:

Command Description
docker start db18 start the database db18
docker stop db18 Stop the database db18
docker ps Show running containers
docker ps -a Show all containers and their status
docker rm db18Remove the database from the container
wsl --shutdown (z CMD) Stop WSL

Komentarze