A Docker image is a template for an application, together with its dependencies, runtime environment and metadata.
A Docker container is a running instance of a Docker image.
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
# The print function | |
print('Hello') # Hello | |
print(3) # 3 | |
# Variables | |
greeting = 'Hello' |
# Challenge one: What does this function do? How do you use it? | |
def welcome(name): | |
return 'Hello ' + name | |
# Solution: | |
### When called and a name passed, this function returns a greeting string for that name. Importantly, this function doesn't print anything to the console, it just creates a string that we can then print later, or do other things with. | |
person = 'Graham' |
# Lists | |
numbers = [3, 5, 7, 4, 2] | |
## Don't worry about remembering the syntax, as long as you can refer back to an example. | |
print(numbers) | |
print(max(numbers)) |
def all_possible_ips(): | |
for number in range(255): | |
yield '172.31.32.' + str(number) | |
######################################################### | |
import unittest | |
class SaunaTests(unittest.TestCase): |
def all_possible_ips(): | |
for number in range(10, 255): | |
yield '172.31.32.' + str(number) | |
def all_available_ips(unavailable): | |
for ip in all_possible_ips(): | |
if ip not in unavailable: | |
yield ip | |
######################################################### |
import pyVmomi # Use the pyVmomi module we downloaded | |
import pyVim.connect | |
import ssl # Use the ssl module from the standard library to avoid certification here. | |
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) | |
context.verify_mode = ssl.CERT_NONE | |
host='???' ## Ask another team member for these credentials, or use your own! | |
user = '???' ## Be careful about uploading credentials to public source repositories! | |
password = '???' |
-- Begin lines with two dashes to have the SQL engine ignore them. Great for comments or for storing an old line of code that you might want to use again later. | |
-- IBM i command STRSQL enters interactive SQL, from which you can run SQL statements. | |
-- The SOFPACK table stores information about software packages. | |
-- In SQL, use SELECT to query tables. | |
-- The * here is a wildcard meaning all columns. | |
SELECT * FROM sofpack |
https://hub.docker.com/_/busybox
For busybox, the default execution is sh
. So, after using run
, we find ourselves in a shell environment:
docker run -it busybox
But we can specify an alternate command to run in the busybox container by appending it to the Docker run command: