Imagine you have a web application container that needs to access configuration settings stored in a file on your host system. This file might contain sensitive information like database credentials or API keys. Storing such sensitive data directly within the container image can lead to security risks, particularly when sharing the image. To mitigate this issue, Docker provides storage options that help bridge the gap between container isolation and your host machine’s data.
Docker offers two primary storage options for persisting data and sharing files between the host machine and containers: volumes and bind mounts.
Here we will use the bind mount
docker run -it --mount type=bind,source=d:\\MyFolder\\temp,target=/app/data wordcounterapp:latest -s /app/data/config
e.g The above is the example of a console app running in a container . It counts the words in a sentence . I ve put a sentence in a file on my d drive in windows and mounted it to container and passed the argument
I have a windows 11 host machine so my example is the use case where i have file in my local machine in a directory called "temp" and i want to mount it to a container .so i will mount the content of the directory on my source system to the container file system.
so in the above command , the source is d:\\MyFolder\\temp
target is /app/data/config
Note: Please make sure that file path is correct and there is no spaces for source and target values. for e.g the space shown below between cmdline argument and value will also give error
Replace <path_to_your_workspace>, <your_dockerhub_username>, <your_image_name>, and <version> with your actual values. Note : This command need to be execute in the host file system not inside container
Here’s a breakdown of that command:
devcontainer build: This is the main command for building a development container. It’s part of the Dev Containers specification, which allows you to define your development environment as code.
--workspace-folder <my_repo>: This flag specifies the root folder of your workspace. Replace <my_repo> with the path to your repository. For example, if your repository is in a folder named project, you would use --workspace-folder project.
--push true: This flag indicates whether the built image should be pushed to a container registry. By setting it to true, the image will be pushed after the build.
--image-name <your_dockerhub_username>/<my_image_name>:<optional_image_version>: This flag specifies the name (and optionally the version) of the image. Replace <your_dockerhub_username> with the docker user name which you can find it once you login to docker.com under the profile . Replace <my_image_name> with the desired name for your image. You can also include an optional version tag by replacing <optional_image_version>. For example, myapp:latest.
for example , refer the above command i am executing the devcontainer command from the root directory of my repo that contains .devcontainer folder which makes it easy . Hence you will see that i ve indicated a “.” (dot) after the –workspace-folder parameter switch .
Once i execute command , since you have already authenticated docker earlier it will push your image to the docker hub and if it is successful , you will get the following :
You will be prompted to enter your PAT (Personal Access Token) (click here to see how PAT can be created )
Step 02 : Navigate to Your Repository Directory: Use cd to go to the directory where your repository is located or where you need to clone your Repository .
Step 03 : Run Git Commands: You can now run standard Git commands like git status, git add, git commit, and git push in your terminal.
The following post outlines a scenario where you need to clone a repo within a github organization . To clone a repo you use git clone https://github.com/YOUR-ORGANIZATION/REPO-NAME however if you use it for a repo that resides within an organization , as of date you will end up with an error : fatal: repository ‘https ://github.com/ORGNAME/REPO-Name.git/’ not found The solution is to use the following comand git clone https://username@github.com/YOUR-ORGANIZATION/REPO-NAME.git You’ll be prompted to enter your password or token Hope this helps someone who faces this issue .
Setting up an Apache web server on Ubuntu running within Windows Subsystem for Linux (WSL) can be a straightforward process that brings the power of Linux to your Windows environment. Here’s a concise guide to get you started:
Update Your System: Before installing any new software, it’s always a good idea to update your package lists. Open your Ubuntu terminal and execute:
sudo apt update
This ensures you have the latest information about available packages and their versions.
Install Apache: To install the Apache web server, use the following command:
sudo apt install apache2
This command installs the Apache2 package from the Ubuntu repositories.
Start Apache Service: Once installed, you can start the Apache service using:
sudo service apache2 start
This command will start the Apache server, and you should now have a running web server on your system.
Verify Installation: To confirm that Apache is running, open a web browser and navigate to http://localhost. You should see the default Ubuntu Apache web page, indicating that the server is operational.
Manage Apache Service: You can check the status of the Apache service with:
systemctl status apache2
To stop, start, or restart Apache, you can use the stop, start, or restart options with the service command, respectively.
Configure Your Environment: With Apache installed, you can begin configuring your environment to suit your development needs. This includes setting up virtual hosts, securing your server, and optimizing performance.
Remember, when working with WSL, you have the flexibility of a full Linux kernel at your disposal, allowing you to run a wide range of Linux software on Windows. Whether you’re developing websites, testing applications, or just exploring Linux, WSL paired with Apache provides a robust platform for your web server needs.
For a more detailed guide, including setting up SSL and advanced configurations, you can refer to online tutorials and resources that provide step-by-step instructions. Happy hosting!
Git is an essential tool for developers, providing a robust version control system that is integral to modern software development. Keeping Git up-to-date ensures access to the latest features, improvements, and security patches. For Windows users, upgrading Git can be done through the command line with relative ease. Here’s a step-by-step guide to help you ensure your Git installation is current.
Step 1: Check Your Current Git Version
Before upgrading, it’s important to know which version of Git you’re currently running. Open Command Prompt or PowerShell and enter the following command:
git --version
This will display the version number of your installed Git.
Step 2: Update Git
The command to update Git on Windows depends on your current version. If you’re running a version between 2.14.2 and 2.16.1, use:
git update
For versions later than 2.16.1, the command changes to:
git update-git-for-windows
Running the appropriate command will either update your Git installation or inform you that you’re already using the latest version.
Step 3: Verify the Update
After running the update command, it’s a good practice to verify that the update was successful. Use the same command as in Step 1 to check your Git version again:
git --version
If the version number has changed, congratulations, you’ve successfully updated Git on your Windows machine!
Troubleshooting
If you encounter any issues or if your version of Git is older than 2.14.2, you may need to manually download the latest installer from Git’s official website and run it just like you would for a fresh installation.
By following these steps, you can keep your Git installation up-to-date and maintain a smooth workflow. Remember, staying current with software updates is not only about having the latest features but also about ensuring the security and efficiency of your development environment. Happy coding!
In MSYS2, packages are installed into different environments based on the type of package and the environment you are using. Here are the main environments:
MSYS: Contains Unix-like tools and is always active. Packages installed here are placed under /usr.
MINGW32: For 32-bit MinGW-w64 packages, installed under /mingw3.
MINGW64: For 64-bit MinGW-w64 packages, installed under /mingw64.
UCRT64: Uses the Universal C Runtime, installed under /ucrt64.
CLANG32: Uses the Clang toolchain for 32-bit, installed under /clang32.
CLANG64: Uses the Clang toolchain for 64-bit, installed under /clang64.
MSYS2 How to know which is the default environment.
echo $MSYSTEM This command will display the current environment, such as MSYS, MINGW32, MINGW64, UCRT64, CLANG32, or CLANG64
MSYS2 How to change the default environment ?
To change the default environment in MSYS2, you can set the MSYSTEM environment variable to the desired environment. Here’s how you can do it:
Open MSYS2 Terminal: Start the MSYS2 terminal.
Set the Environment Variable: Use the “export” command to set the “MSYSTEM” variable. For example, to switch to the “MINGW64” environment, you would use: export MSYSTEM=MINGW64
You can also create a shortcut that opens MSYS2 with a specific environment. Here’s how:
Create a Shortcut: Right-click on your desktop and select New > Shortcut.
Enter the Path: Enter the path to the MSYS2 executable followed by the desired environment. For example: C:\msys64\msys2_shell.cmd -mingw64
Name the Shortcut: Give your shortcut a name, like “MSYS2 MINGW64”, and click Finish. Now, you can use this shortcut to open MSYS2 directly in the “MINGW64” environment.
Once you change the default environment to MINGW64 and run the pacman -Suy command, the packages will be installed in the MINGW64 environment. Specifically, they will be placed under the /mingw64 directory.
Solution : Refresh the Datasource and then save and publish the app . Detailed description is given below .
Description I created a power apps with 2 text boxes where i am fetching logged in user’s Business unit and then country where he belongs . Now , to make it clear – i am using Dynamics 365 as a data source . – tables involved , systemuser (User), business unit , country i added a data source for User’s table . Approach : i add a global variable on start on the app where i got the user object based on the logged in user’s email address .I stored it in a variable called D365
I set the value of other 2 text boxes which should have the logged in user’s Business unit ID and country as shown below D365User.'Business Unit'.Country.Name D365User.'Business Unit'.Country.Country
Issue : However when i run the app it shows the data correctly for the 2 textboxes . However when i publish the app it doesn’t show any data .It showed “Getting Data ….” then blank
Solution : click “Refresh” Data source in the data source menu as shown below
The most straightforward method to check your OS details is by using the cat command on the /etc/os-release file. This file contains identification data of the Linux distribution and looks something like this:
This blog post may contain affiliate links. If you click on these links and make a purchase, I may receive a small commission at no additional cost to you. These commissions help support the maintenance and growth of this blog.
Dive into the world of excitement with a racing car kit that comes with lights and sounds. Learn to use a working drill to assemble the car, and have fun mixing and matching pieces to create colorful versions. It’s endless pit-stop fun for mini mechanics! Feel free to check out more details click here