Monday, June 27, 2022
HomeCyber SecurityIssues Passing Parameters to Docker Container | by Teri Radichel | Bugs...

Issues Passing Parameters to Docker Container | by Teri Radichel | Bugs That Chew | Jun, 2022


A number of glitches passing arguments to Docker and repair them

Initially, how do you go parameters to a Docker container?

If you wish to go them whenever you’re constructing the container:

docker construct -t 2ndSightLab/pentest --build-arg param=check

Reference the variable

$param

If you wish to go them whenever you’re working the container in case you’re entry level is bash:

docker run 2ndSightLab/pentest Hey There!

Then in your bash entry level file:

a=$1
b=$2
echo "$a $b"

That might print out:

Hey There!

One factor to concentrate on is that in case you go in additional than 9 variables you’ll wish to add curly braces round every variable:

j=${10}

You probably have an argument with areas in it then you definately’ll must put it in quotes:

docker run 2ndSightLab/pentest "Hey" "Sizzling Stuff!"

In any other case you’d find yourself with three variables within the above as a substitute of two.

You might need completely different argument values at construct time that you just don’t wish to have out there at run time.

You may use setting variables as nicely however I’d reasonably not retailer values there for probably the most half. I retailer parameters encrypted in AWS parameter retailer or secrets and techniques supervisor for probably the most half. Comparable features exist on all the main cloud platforms.

Teri Radichel — Comply with me @teriradichel on Twitter

© 2nd Sight Lab 2022

____________________________________________

About this weblog:

Wish to study extra about Cybersecurity and Cloud Safety? Try: Cybersecurity for Executives within the Age of Cloud on Amazon

Want Cloud Safety Coaching? 2nd Sight Lab Cloud Safety Coaching

Is your cloud safe? Rent 2nd Sight Lab for a penetration check or safety evaluation.

Have a Cybersecurity or Cloud Safety Query? Ask Teri Radichel by scheduling a name with IANS Analysis.

Cybersecurity & Cloud Safety Assets by Teri Radichel: Cybersecurity and Cloud safety lessons, articles, white papers, shows, and podcasts



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments