Page tree

Michael O'Brien

Skip to end of metadata
Go to start of metadata

https://docs.docker.com/engine/reference/run/

Running Docker in the Cloud

There are multiple ways of running docker in the cloud.  This list is in order of management (cloud managed at the top)



ServiceControl
plane
Data
plane
Inter-service
network
multiple
containers
per host
InstallationCost










Docker under a Cloud Managed Kubernetes service on Managed VM infrastructureEKS FargateManagedManaged
serverlessManaged$144 US/month for control plane
+ EC2 cost

Docker under a Cloud Managed Kubernetes service on client managed VM infrastructureEKS EC2managedunmanaged
yes
EC2 cost

Docker under a Cloud Managed Docker service on Managed VM InfrastructureECS Fargatemanagedmanaged
serverless


Docker on ECS on EC2 instances (in a Auto Scaling Group)ECS EC2managedunmanaged
yes
EC2 cost + NLB

Docker on Elastic BeanstalkElastic Beanstalkmanagedunmanaged
no


RKE Rancher Kubernetes EngineEC2unmanagedunmanaged
yesRKE

Docker on single EC2sEC2unmanagedunmanaged
yesmanual

Running Docker in AWS

Running Docker in Azure

Docker Installation

see Kubernetes Developer Guide#DockerInstallation

Docker Run

docker run -p 8080:8080 -p 8001:8001 -d --name drools-workbench jboss/drools-workbench-showcase:latest
docker run -p 8180:8080 -d --name kie-server --link drools-workbench:kie-wb jboss/kie-server-showcase:latest

Docker Pull

Check your login first

obrienlabs:devops michaelobrien$ docker login
Authenticating with existing credentials...
Login Succeeded

Docker Exec

Docker History

Docker log

docker logs -f testconfig_aai-resources.api.simpledemo.openecomp.org_1

Docker Build

docker build -t nexus3.onap.org:10001/openecomp/dcae/pgaas -f Dockerfile .


Step 29/29 : ENTRYPOINT usr/local/bin/entrypoint.sh

 ---> Using cache

 ---> d3cf07a80918

Successfully built d3cf07a80918

Successfully tagged nexus3.onap.org:10001/openecomp/dcae/pgaas:latest

obrienbiometrics:pgaas michaelobrien$ docker images

REPOSITORY                                   TAG                 IMAGE ID            CREATED             SIZE

nexus3.onap.org:10001/openecomp/dcae/pgaas   latest              d3cf07a80918        9 minutes ago       1.03GB

Docker Registry Image Search

where the image name is "dcae-controller"

obrienbiometrics:pgaas michaelobrien$ curl -Ss -u docker:docker https://nexus3.onap.org:10001/v2/dcae-controller/tags/list | jq

{

  "name": "dcae-controller",

  "tags": [

    "0.1.0-SNAPSHOT",

    "1.0.0"

  ]}

Docker Push

Dockerhub

root@obriensystemskub0:~/oom/kubernetes/dcae/pgaas# export DOCKER_ID_USER="obrienlabs"
root@obriensystemskub0:~/oom/kubernetes/dcae/pgaas# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: obrienlabs
Password:
Login Succeeded
root@obriensystemskub0:~/oom/kubernetes/dcae/pgaas# docker build -t obrienlabs/pgaas -f Dockerfile .
Sending build context to Docker daemon 23.55 kB
Step 1 : FROM ubuntu:16.04
 ---> d355ed3537e9
....
Successfully built 257430a38254
root@obriensystemskub0:~/oom/kubernetes/dcae/pgaas# docker tag obrienlabs/pgaas obrienlabs/pgaas:1
root@obriensystemskub0:~/oom/kubernetes/dcae/pgaas# docker push  obrienlabs/pgaas:1
The push refers to a repository [docker.io/obrienlabs/pgaas]
ee716c896001: Pushed
....5a4c2c9a24fc: Pushed
cb11ba605400: Pushed
1: digest: sha256:fb09855b323fe83aaa161725910cd2f6d7ff6306035e6f5f2df40b99149e8fed size: 6157

pull on separate machine
obrienbiometrics:oom michaelobrien$ docker pull obrienlabs/pgaas:1
1: Pulling from obrienlabs/pgaas
23a6960fe4a9: Extracting [===>                                               ]  3.441MB/45.89MB
e9e104b0e69d: Download complete
cd33d2ea7970: Download complete
534ff7b7d120: Download complete

Docker save/load


Docker cleanup

Docker full system prune

$ docker system df
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              41                  13                  9.123GB             4.001GB (43%)
Containers          24                  22                  4.823GB             4.823GB (99%)
Local Volumes       8                   1                   8.316GB             2.904GB (34%)
Build Cache         0                   0                   0B                  0B

$ docker system prune -a                                                                                                                                                             WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all images without at least one container associated to them
  - all build cache
Total reclaimed space: 13.19GB
$ docker system df
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              11                  11                  757.9MB             48.46MB (6%)
Containers          22                  22                  6.017kB             0B (0%)
Local Volumes       8                   0                   8.316GB             8.316GB (100%)
Build Cache         0                   0                   0B                  0B


Stop all containers

docker stop  $(docker ps -a -q)

Remove all containers

docker rm $(docker ps -a -f status=exited -q)

Remove all images

docker rmi $(docker images -a -q) --force

Remove all volumes

docker volume rm $(docker volume ls)

Updating WARs/JARs


Attaching to a Debug Port

-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5432

List Docker Mounts

 

Docker fails to start on OSX

https://github.com/docker/for-mac/issues/989

reset to defaults

Docker in Docker

DIND

http://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/

https://github.com/jpetazzo/dind

https://hub.docker.com/_/docker/

Run an Ubuntu Desktop container on Docker - for nested Docker

We used this one in ONAP https://hub.docker.com/r/dorowu/ubuntu-desktop-lxde-vnc - it needs a volume - so we will likely need do dockerfile it - to save state - if you dont

 have local drive share capability from Docker Desktop. Goto http://127.0.0.1:6080/

docker run -p 6080:80 -d --name ubuntu dorowu/ubuntu-desktop-lxde-vnc
# test a file copy
docker cp pom.xml ubuntu:/root/pom.xml

# check it
docker exec -it ubuntu bash
root@6950d3be0f24:/root# ls
Desktop  pom.xml

Network Connections to Other Docker Containers on the same Host

localhost won't work inside a container - it just resolves to itself - use a network or the following URLs

in mac

docker.for.mac.localhost

in windows or both

host.docker.internal

Docker Images by Language

Java

Alpine

Tomcat

Swift

Python


Links


https://github.com/moby/moby/issues/22910


  • No labels