- Wget Docker Registry
- Wget Dockerfile
- How To See What Docker Containers Are Running
- Wget Docker Image
- Wget Docker Image
OpenSSH server, bash, and curl or wget: Run ldd -version to check the glibc version. Run strings /usr/lib64/libstdc.so.6 grep GLIBCXX to see if libstdc 3.4.18 is available. Ubuntu 16.04+, Debian 8+, Raspbian Stretch/9+ and downstream distributions: libc6 libstdc6 python-minimal ca-certificates tar: openssh-server bash and curl or wget.
Estimated reading time: 7 minutes
Docker provides an API for interacting with the Docker daemon (called the DockerEngine API), as well as SDKs for Go and Python. The SDKs allow you to build andscale Docker apps and solutions quickly and easily. If Go or Python don't workfor you, you can use the Docker Engine API directly.
The Docker Engine API is a RESTful API accessed by an HTTP client such as wget
orcurl
, or the HTTP library which is part of most modern programming languages.
Install the SDKs
- Ubuntu is a Debian-based Linux operating system based on free software.
- Docker Compose uses the YAML format to create the compose files that can be easily executed using docker-compose up or down commands that will create or remove all the containers and configurations within a compose file, respectively. Let's install Docker Compose on the Ubuntu server. Install the current stable release of Docker Compose.
- I created a docker container from my OS X VM Docker host. I created it using the run command and created the container based off the ubuntu:xenial image off docker hub. I'm now connected to my container after it's created and logged in as root and at the command prompt inside my container.
Use the following commands to install the Go or Python SDK. Both SDKs can beinstalled and coexist together.
Go SDK
The client requires a recent version of Go. Run go version
and ensure that you are running a currently supported version of Go
Read the full Docker Engine Go SDK reference.
Python SDK
Recommended: Run
pip install docker
.If you can't use
pip
:- Download the package directly.
- Extract it and change to the extracted directory,
- Run
python setup.py install
.
Read the full Docker Engine Python SDK reference.
View the API reference
You canview the reference for the latest version of the APIor choose a specific version.
Wget Docker Registry
Versioned API and SDK
Wget Dockerfile
Wget Docker Registry
Versioned API and SDK
Wget Dockerfile
The version of the Docker Engine API you should use depends upon the version ofyour Docker daemon and Docker client. Refer to the versioned API and SDKsection in the API documentation for details.
SDK and API quickstart
Use the following guidelines to choose the SDK or API version to use in yourcode:
- If you're starting a new project, use the latest version,but use API version negotiation or specify the version you are using. Thishelps prevent surprises.
- If you need a new feature, update your code to use at least the minimum versionthat supports the feature, and prefer the latest version you can use.
- Otherwise, continue to use the version that your code is already using.
As an example, the docker run
command can be easily implemented using theDocker API directly, or using the Python or Go SDK.
When using cURL to connect over a unix socket, the hostname is not important. Theexamples above use localhost
, but any hostname would work.
Using cURL 7.47.0 or below?
The examples above assume you are using cURL 7.50.0 or above. Older versions ofcURL used a non-standard URL notationwhen using a socket connection.
If you are using an older version of cURL, use http://
instead,for example, http:/v1.41/containers/1c6594faf5/start
For more examples, take a look at the SDK examples.
Unofficial libraries
There are a number of community supported libraries available for otherlanguages. They have not been tested by Docker, so if you run into any issues,file them with the library maintainers.
Language | Library |
---|---|
C | libdocker |
C# | Docker.DotNet |
C++ | lasote/docker_client |
Clojure | clj-docker-client |
Dart | bwu_docker |
Erlang | erldocker |
Gradle | gradle-docker-plugin |
Groovy | docker-client |
Haskell | docker-hs |
HTML (Web Components) | docker-elements |
Java | docker-client |
Java | docker-java |
Java | docker-java-api |
Java | jocker |
NodeJS | dockerode |
NodeJS | harbor-master |
Perl | Eixo::Docker |
PHP | Docker-PHP |
Ruby | docker-api |
Rust | docker-rust |
Rust | shiplift |
Scala | tugboat |
Scala | reactive-docker |
Swift | docker-client-swift |
- Using Tiles
- Serving Tiles
If you just want to try things out or you're using an OS other than Ubuntu, and you're using Docker for containerisation, you can try this (thanks to all the contributors there). It's based on the instructions here, but is a pre-built container you can install.
If you don't already have Docker installed, there are lots of 'how-tos' around - see for example here and the links from there.
In this example run-through I'll download data for Zambia and import it, but any OSM .pbf file should work. For testing, try a small .pbf first. When logged in as the non-root user that you run Docker from, download the data for Zambia:
Create a docker volume for the data:
And install it and import the data:
The path to the data file needs to be the absolute path to the data file - it can't be a relative path. In this example it's in the root directory of the 'renderaccount' user.
How long this takes depends very much on the local network speed and the size of the area that you are loading. Zambia, used in this example, is relatively small.
Note that if something goes wrong the error messages may be somewhat cryptic - you might get '… is a directory' if the data file isn't found. The 'time' at the start of the command isn't necessary for the installation and import; it just tells you how long it took for future reference. Also, the postgres version used by this container changed between versions 1.3.5 and 1.3.6 (see here). This means that an 'openstreetmap-data' created with an earlier version won't work - you will need to remove it with 'docker volume rm openstreetmap-data' and recreate.
For more details about what it's actually doing, have a look at this file. You'll see that it closely matches the 'manually building a tile server' instructions here, with some minor changes such as the tile URL and the internal account used. Internally you can see that it's using Ubuntu 18.04. You don't need to interact with that directly, but you can (via 'docker exec -it mycontainernumber bash') if you want to).
How To See What Docker Containers Are Running
When the import is complete you should see something like this:
That tells you how long things took in total (in this case 9.5 minutes).
To start the tile server running:
and to check that it's working, browse to:
You should see a map of the world in your browser.
More Information
This docker container actually supports a lot more than the simple example here - see the readme for more details about updates, performance tweaks, etc.
Viewing tiles
Wget Docker Image
For a simple 'slippy map' we can use an html file 'sample_leaflet.html' which is here in mod_tile's 'extra' folder. Edit 'hot' in the URL in that file to read 'tile', and then just open that file in a web browser on the machine where you installed the docker container. If that isn't possible because you're installing on a server without a local web browser, you'll also need to edit it to replace '127.0.0.1' with the IP address of the server and copy it to below '/var/www/html' on that server.
Wget Docker Image
If you want to load a different area, just repeat the process from 'wget' above. It'll be quicker the next time because the static data needed by the map style won't be needed.