- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1383 Articles for Open Source
4K+ Views
Suppose you have already created a Docker container previously and have worked with it. Now, you have stopped the container. So, the container is in exited state. What if you want to run a command inside the container?Typically, there can be two cases. Either the container is stopped using the Docker stop command or the container is currently running in the background. In such a case, either you can start the container back, access it’s bash, and execute whatever command that you want. This is perfect for containers that are not running. Another solution is that you use the Docker ... Read More
1K+ Views
Suppose you are using a MySQL Docker container and you want to pass environment variables to your container while running the container. It’s always a good idea to isolate the services from the configuration and it’s always advised to use environment variables for this purpose.Predominantly, there are three different ways through which we can pass environment variables to our Docker containers. These are by using the -e, --env-file, and the ENV instruction inside the Dockerfile. Let’s check out all these methods one by one with examples.Passing environment variables using the --env or -e flagTo demonstrate this example, let’s use the ... Read More
15K+ Views
Once you have your Docker container up and running, you can work with the environment of the Docker container in the same way you would do with an Ubuntu machine. You can access the bash or shell of the container and execute commands inside it and play around with the file system. You can build, test, and deploy your applications inside the container itself.Predominantly, there are 3 ways to access the shell of a running container. These are -Using the Docker run command to run a container and access its shell.Using the Docker exec command to run commands in an ... Read More
13K+ Views
Suppose you have an Nginx web server running inside an Nginx container in your host machine. And you have a MySQL database running in your host machine. Now, you want to access the MySQL server in your host machine from the Nginx container. Also, the MySQL is running on your localhost and the host machine does not expose any port to the outside world. Hence, we can conclude that MySQL is bound to be run on localhost only and not accessible to the outside world because it is not bound on the IP address.In this article, we will explain the ... Read More
2K+ Views
We can use the Docker build command to build Docker images using a build context. The build context contains all the files which are required to create your containerized application environment. This includes the Dockerfile to build the Docker images, source code of the application, Dockerignore files, all the files, and directories that you want to be there beforehand in the container when you run it.However, it often happens that you might want to copy some files from the container to the host machine. For example, if you are working on an application inside a Docker container and you have ... Read More
882 Views
In normal cases we make use of the bash_profile or bashrc in case of Ubuntu and zshrc in case of Mac OS, to set our environment variables and then those variables are made available to us everywhere on the terminal we want.Let’s consider a simple example where we have some environment variable in bash_profile and we are making use of it in the terminal.Consider the bash_profile output shown below −immukul@192 dir1 % cat ~/.bash_profile export JAVA_HOME=$(/usr/libexec/java_home) export PATH=$PATH:/usr/local/node/bin export GOROOT=/usr/local/go export GOPATH=/Users/immukul/go_projectsAs we can see there are many variables present in the bash_profile file, we can use these variables in ... Read More
284 Views
Linux provides us with different utility commands that we can make use of to print a random line from any files in the Unix command line. Mostly we make use of either the shuf command or the sort command, and in this article I’ll explain both the commands and which one is better and why.Shuf CommandThe shuf command in Linux is used to write random permutations of the input lines to the standard output. The idea of randomizing the input is the same as one does when the cards are shuffled. On most of the Linux operating systems it is ... Read More
257 Views
Linux provides the famous top command utility that provides us with all the information about the processes, their time, their respective IDs, how much CPU chunk they are consuming and much more. The only issue with that is the processes are not sorted in any order and the order changes frequently.There are certain cases where we would like the output to be in a sorted manner somehow, like sorted in the sense that the process which is using the most network will be at the top.One such command line program that we can use that will provide us the desired ... Read More
5K+ Views
We know that an operating system is considered the backbone of any system that you may use. The three most common and widely used operating systems share things in common just as well as they share differences. While there are cases where one might outperform another, those cases and such scenarios are very rare.The most notable difference one can notice is how they store the files in their file structure, like in case of windows, it follows a directory structure to store the different kinds of files of the user, whereas the Mac OS file structure is known as MAC ... Read More
3K+ Views
We know that the SED command in Linux stands for stream editor and is mainly used to perform functions on files, and the functions usually are either searching for a word, or replacing it or insertion of something and few more. It is a very useful command and can be found on the Linux kernel.It should also be noted that the BSD (Berkeley Software Distribution) sed shipped with the OS X does need the -i flag to work and the GNU one doesn’t.One way to make the GNU version of the SED to work on the Mac OS X, is ... Read More