Docker: Difference between revisions

From bibbleWiki
Jump to navigation Jump to search
No edit summary
Line 55: Line 55:
Create a volumes
Create a volumes
  docker volume create hello
  docker volume create hello
=Build MediaWiki Container=
<syntaxhighlight lang="bash">
https://github.com/wikimedia/mediawiki-docker/blob/38d4e7f77f8b5b4efda91f969ccba2475fc2c597/1.35/apache/Dockerfile
</syntaxhighlight>

Revision as of 10:38, 24 December 2020

Common commands

Show the current docker image running

sudo docker ps 

Show the images available

sudo docker images

Stop a container id

sudo docker stop <container id>

Start a container id

sudo docker stop <container id>

Show ports exposed

sudo docker port <container id>

List current containers

sudo docker container ls -s

Remove a container

sudo docker container rm <container id>

Pull a container

sudo docker pull <image name>

This will remove all images without at least one container associated to them

docker image prune -a

This will remove all stopped containers

docker container prune

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
The postgres:alpine is the image name
The -p is the port to expose which is the default for postgress The -v is where the data will be stored

Volumes

List volumes

docker volume ls 

Create a volumes

docker volume create hello

Build MediaWiki Container

https://github.com/wikimedia/mediawiki-docker/blob/38d4e7f77f8b5b4efda91f969ccba2475fc2c597/1.35/apache/Dockerfile