Are you into Docker but never heard of Carina? Well, in this introductory series I will teach you how to get started in this amazing platform!
Check it out:
We all know, once the main process in any given container stops running, well, our container stops as well and every log goes with it. Well, creating a volume might just be solution.
What happens when we have a container that ‘fails’ and we don’t really have a way to know why such thing happen since now that our container is dead, well, logs and everything else have died as well.
A nice way to approach this problem is to create a local host volume to store our container(s) log files for any given application, for this example we are using NGINX.
Let’s say we have a custom Nginx image that is giving us problems and dies after an ‘X’ amount of time and we have no way to know what is happening since we can’t access such logs, well, let’s create a local host volume that will include every Nginx log file!
First, we need to create the container with such volume path:
docker run --name webserver -d -P -v /containers/logs/nginx:/var/log/nginx nginx
Now, we can easily access such logs:
cd /containers/logs/nginx && ls
We should see access.log and error.log
Now, figure out the problem and keep on working! 🙂
Docker tag is helpful when you are trying to push a locally created image to Docker hub but the name of your Docker Hub image repository is different than the local version, example:
You might have a local image named: local/ubuntu:1.0
Now, every repository created in Docker Hub begins with your username, in this case we will use my nickname: salcoder
Your repository is essentially named salcoder/ubuntu:1.0 so as you can see the problem is that local should be salcoder instead, well, lets fix it!
Docker provides a tool (docker tag)which will allow us to change the name of our local image so it can match with Docker Hub.
We type the following:
docker tag local/ubuntu:1.0 salcoder/ubuntu:1.0
docker push salcoder/ubuntu:1.0
Remember that :1.0 is the actual tag, you can name it latest or whatever else you like.
I hope this quick reference was helpful! Questions, suggestions are always appreciated!