|
|
Line 1: |
Line 1: |
| =Build Container=
| |
| ==RUN command==
| |
| RUN su-exec volpara git clone https://github.com/bibble235/aports
| |
|
| |
|
| ==Copying from on container==
| |
| Given the container
| |
| FROM ubuntu:18.04 AS opencv_build
| |
| Copying can be done using
| |
| COPY --from=opencv_build /usr/local/opencv/ /usr/local/
| |
|
| |
| == Creating a docker postgres image ==
| |
| This exposes the default port 5432 for postgres
| |
| docker run --name postgresq-spring -e POSTGRES_USER=iain -e POSTGRES_PASSWORD=password -p 5432:5432 -v /data:/var/lib/postgresql/data -d postgres:alpine
| |
|
| |
| The -d is to run the container in the background<br>
| |
| The postgres:alpine is the image name<br>
| |
| The -p is the port to expose which is the default for postgress
| |
| The -v is where the data will be stored
| |
|
| |
| ==Running a Container==
| |
| Sample for running a container with name test, ip 172,18.0.11, network to run on as billnet, capital P to expose the port (not for production), remove container when exit, it to have the errors go to the host console, and ps/dataservice for the image name
| |
| docker run --name test --ip=172,18.0.11 --net=billnet -P --rm -it ps/dataservice
| |
|
| |
| =Build MediaWiki Container=
| |
| ==Build your own Docker Image==
| |
| Get the definition from github and build the container.
| |
| <syntaxhighlight lang="bash">
| |
| https://github.com/wikimedia/mediawiki-docker/blob/38d4e7f77f8b5b4efda91f969ccba2475fc2c597/1.35/apache/Dockerfile
| |
| docker build .
| |
| </syntaxhighlight>
| |
| ==Use Prebuilt==
| |
| We can install the prebuilt one with
| |
| <syntaxhighlight lang="bash">
| |
| docker pull mediawiki
| |
| </syntaxhighlight>
| |
| <br>
| |
| We can find the container with the command
| |
| <syntaxhighlight lang="bash">
| |
| docker ps --format "table {{.ID}}\t{{.Status}}\t{{.Names}}"
| |
|
| |
| b0ff6611123e Up 2 minutes some-mediawiki
| |
| 898c8f40818d Up 6 hours k8s_operator_openshift-web...
| |
| b02230ae7074 Up 6 hours k8s_kube-dns_kube-dns-qhbvf_....
| |
| ea19641bc9a1 Up 6 hours k8s_webconsole_webconsole-...
| |
| 0dc6ee563a9b Up 6 hours k8s_registry_docker-registry-...
| |
| 0b6ea1064152 Up 6 hours k8s_operator_openshift-servic...
| |
| ...
| |
| </syntaxhighlight>
| |
| From there we can get the ip address with
| |
| <syntaxhighlight lang="bash">
| |
| docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' b0ff6611123e
| |
|
| |
| 172.17.0.9
| |
| </syntaxhighlight>
| |
| ==Delete Container==
| |
| We can stop the contain and delete it
| |
| <syntaxhighlight lang="bash">
| |
| docker stop b0ff6611123e
| |
| docker container rm b0ff6611123e
| |
| </syntaxhighlight>
| |