Virtualization and containers are the technologies that enable isolation of environments running on the same hardware, and can be used in some of the cloud offerings as well as in your local hardware.
This session will introduce you to Vagrant, Ansible, and Docker with examples, showing step by step guides to automatically create and provision virtual Oracle environments using different solutions (no need to code, just to configure existing code).
11. Docker – command line
Windows – control VM status
11
D:>docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default - virtualbox Running tcp://192.168.99.100:2376 v18.01.0-ce
Management Commands:
checkpoint Manage checkpoints
config Manage Docker configs
container Manage containers
image Manage images
network Manage networks
node Manage Swarm nodes
plugin Manage plugins
secret Manage Docker secrets
service Manage services
stack Manage Docker stacks
swarm Manage Swarm
system Manage Docker
volume Manage volumes
D:>docker Commands:
attach Attach local standard input, output, and error streams to a running contain
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
deploy Deploy a new stack or update an existing stack
diff Inspect changes to files or directories on a container's filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on Docker objects
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
login Log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
ps List containers
...
17. Example – Oracle DB using Docker Image
Check local images
17
D:>docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
container-registry.oracle.com/database/enterprise 12.2.0.1 12a359cd0528 5 months ago 3.44GB
Define image settings
D:>echo DB_MEMORY=1Gb >ora.conf
Start the container
D:>docker run -d -it --name ora122 -P --env-file ora.conf container-registry.oracle.com/database/enterprise:12.2.0.1
5896d37c1cae083c9ab82ec52cf9900a3b22a012b5257c1cb065a6093d7d55c5
Check running containers
D:>docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5896d37c1cae container-registry.oracle.com/database/enterprise:12.2.0.1 "/bin/sh -c '/bin/ba…" 24 minutes ago Up
24 minutes (healthy) 0.0.0.0:32769->1521/tcp, 0.0.0.0:32768->5500/tcp ora122
30. Vagrant - commands
30
D:GitHub>vagrant box list
bento/oracle-6.9 (virtualbox, 201801.02.0)
kikitux/oracle6-racattack (virtualbox, 16.01.01)
oravirt/ol67 (virtualbox, 20170424)
oravirt/ol68 (virtualbox, 20170418)
oravirt/ol72 (virtualbox, 20170425)
D:GitHub>vagrant
Usage: vagrant [options] <command> [<args>]
box manages boxes: installation, removal, etc.
init initializes a new Vagrant environment by creating a Vagrantfile
validate validates the Vagrantfile
up starts and provisions the vagrant environment
provision provisions the vagrant machine
push deploys code in this environment to a configured destination
port displays information about guest port mappings
status outputs status of the vagrant machine
connect connect to a remotely shared Vagrant environment
suspend suspends the machine
resume resume a suspended vagrant machine
halt stops the vagrant machine
destroy stops and deletes all traces of the vagrant machine
reload restarts vagrant machine, loads new Vagrantfile configuration
snapshot manages snapshots: saving, restoring, etc.
ssh connects to machine via SSH
powershell connects to machine via powershell remoting
rdp connects to machine via RDP