Attach the stop container in the Docker
Check the container which is stopped by running ps -a command:
sunny@Oracle1:/etc$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
eeb55035fffe orcl2-image "/bin/sh" 10 minutes ago Exited (0) 4 minutes ago fervent_herschel
Start the docker with container id:
#docker start <container-name>/<container id>
sunny@Oracle1:/etc$ docker start eeb55035fffe
eeb55035fffe
Check the Docker container is running:
#docker ps
sunny@Oracle1:/etc$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
eeb55035fffe orcl2-image "/bin/sh" 10 minutes ago Up 11 seconds (health: starting) 1521/tcp, 5500/tcp fervent_herschel
Stop the container in Docker
#docker stop <container-name>/<container-id>
sunny@Oracle1:/etc$ docker stop eeb55035fffe
eeb55035fffe
Use the docker container by attaching:
sunny@Oracle1:/etc$ docker attach eeb55035fffe
sh-4.2$
sh-4.2$ sqlplus / as sysdba
SQL*Plus: Release 21.0.0.0.0 - Production on Thu Feb 2 10:26:09 2023
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to an idle instance.
SQL>