Monday, November 19, 2018

Connect to docker background running container

Let's say I have started a container in background to run some databases.
Here the case is for Oracle.

docker run -d -p 8080:8080 -p 1521:1521 sath89/oracle-12c
 
Now, if I want to connect directly to it to see the output.

docker attach <containerid>


But, if I want to type more commands, above won't be useful as it is connected to same tty console.

We can do it using the exec command of docker, so that we will launch the bash console using it to type our commands.


docker exec -it <containerid> bash


Reference



No comments:

Post a Comment