Discontinued: please use the "dart" Docker Official Image.
100K+
Please consider using the new Docker Official Images for Dart: https://hub.docker.com/_/dart
google/dart-runtime is a docker base image that
makes it easy to dockerize a standard Dart application.
It can automatically bundle a Dart application and its dependencies with a single line Dockerfile.
It is based on the google/dart-runtime-base base image.
Create a Dockerfile in your Dart application directory with the following
content:
FROM google/dart-runtime
To build a docker image tagged with my/app run:
docker build -t my/app .
To run this image in a container (assuming it is a server application listening on port 8080):
docker run -d -p 8080:8080 my/app
See the sources for google/dart-hello based on this image.
The image assumes that your application:
pubspec.yaml file listing its dependencies.bin/server.dart as the entrypoint script.8080If you have package dependencies which do not meet the last requirement
take a look at using either the base image google/dart-runtime-base
or google/dart.
bin
server.dart
packages
...
pubspec.yaml
When building your application docker image, ONBUILD triggers fetch the
dependencies listed in the pubspec.yaml file and cache them appropriatly.
The dart-runtime image enables the
Observatory for the Dart
VM running in the container. The Observatory is listening on the default
port 8181. Just map that port to the host when running the app:
docker run -d -p 8080:8080 -p 8181:8181 my-app
If using boot2docker you can access the Observatory using the docker host network on http://192.168.59.103:8181/ (replacing 192.168.59.103 with what you 'boot2docker ip' says).
The dart-runtime image can receive options for the Dart VM through
the environment variable DART_VM_OPTIONS.
docker run -d -p 8080:8080 \
--env DART_VM_OPTIONS='--old_gen_heap_size=2048 --verbose-gc' \
my/app
If you are using this image with App Engine Managed VMs, the app.yaml
file must be alongside the Dockerfile in the project directory.
You can set up Observatory access by adding the following to the
app.yaml file:
network:
forwarded_ports: ["8181"]
You can pass VM flags by adding the following to the app.yaml file:
env_variables:
DART_VM_OPTIONS: --old_gen_heap_size=2048 --verbose-gc
Content type
Image
Digest
Size
308.4 MB
Last updated
over 4 years ago
docker pull google/dart-runtime:2.16-devPulls:
312
Jul 6 to Jul 12