In this blog, you will learn how you can completely work inside docker
- How to check the contents available inside the docker container
- How to install nano inside the docker container
- How to copy contents to/from the docker container
- How to edit and update the files inside the docker container.
Like in the previous blog, you must have learned how you can pull the docker image for Rasa and how you can customize the Rasa chatbot with respect to the docker container. Now you will learn how you can use the docker container like a separate and independent operating system. To understand this practice we will completely work inside docker container to customize and talking to the bot.
Now, as you have seen in our previous blogs how to pull the images and to update it indirectly. But now you will learn that how you can check the contents inside any docker container and also how you can install and use the dependencies inside that.
check the contents available inside the docker container
Firstly, let’s check what contents do we have inside the any docker that you are checking for. For that first verify that you have the docker images on your system and that too is running alive. Check what docker images you have on your system with the given command,
Now, verify that the image that you want to check is alive or not with the given command,
This is will give you the results like this.
Here you can see the result of the above commands. From here now it is clear that we have a container running alive. The reason why we are focusing on the docker container to be alive is that you can access the docker container only if the docker container is running and live.
Now as we have a docker container for rasa is running. We can now run the given command with the container id of your running container.
docker exec -t -i <container_id> /bin/bash Here, replace the container_id with the container id of the running image example: docker exec -t -i 29263da53e8e /bin/bash
Once you will execute this command you will get the output like the one shown below:
If you will get the output like the one you can see above that means now you are inside the docker container and you can now check the contents inside the docker container. Also, you can now treat this container as an independent Linux operating system that can execute anything through the command line.
install nano TO WORK inside docker container
Now run the given commands to check and see the contents inside it and let’s start the work inside the docker container.
ls nano domain.yml
The above command will help you check the content inside the current directory of the container and also you will be able to edit the files with nano if it is already installed. But as I am running nano for the first time inside this container so it will show me the results like this:
As you can see above in the image, “nano :command not found”. This simply means that you have to install nano to work inside docker container and to do that run the following commands:
exit docker exec --user root -t -i 29263da53e8e /bin/bash apt install nano
With the successful installation of nano now you can work inside docker. So you can now edit the file with nano and you do whatever else you want to do here. Now customize your chatbot in the way you want to shape it and design it.
For more clarity, check this video,
How to copy contents to/from the docker container
Now let’s understand how we can copy the contents to/from the docker container. First let’s see how to copy the contents from the container to the local system, For that first, you should be working outside the docker container
exit docker cp 29263da53e8e:/app/. .
and now let’s do the reverse step, copying from local to the docker container,
docker cp . 29263da53e8e:/app/
So, with the above commands, you will be able to copy the files/directories to/from the docker container. From the above demo, I believe that now you have got a crystal clear understanding of how to work inside docker container and also how to transfer the data to/from the docker container.
For more understanding and clarification on rasa chatbot, you can check out the official website of rasa and docker hub. Also, you can check these video contents for the deployment of rasa Chabot on the live server with Google Cloud Platform and link it to the domain name.
This is all about how to work inside docker container. I hope you have got a crystal clear understanding of it. But still, if you are facing any difficulties in understanding and implementing it. Feel free to leave a comment below in the comment section.
Stay Tuned and Happy Learning. 🙂