Tutorial by Examples: docker

It is possible to save a Docker container's filesystem contents to a tarball archive file. This is useful in a pinch for moving container filesystems to different hosts, for example if a database container has important changes and it isn't otherwise possible to replicate those changes elsewhere. Pl...
Requirements: Docker can be installed on any Linux with a kernel of at least version 3.10. Docker is supported on the following 64-bit versions of Ubuntu Linux: Ubuntu Xenial 16.04 (LTS) Ubuntu Wily 15.10 Ubuntu Trusty 14.04 (LTS) Ubuntu Precise 12.04 (LTS) Easy Installation Note: Installi...
docker network create app-backend This command will create a simple bridged network called appBackend. No containers are attached to this network by default.
docker network rm app-backend This command removes the user-defined app-backend network from the Docker host. All containers on the network not otherwise connected via another network will lose communication with other containers. It is not possible to remove the default bridge bridge network, th...
docker network inspect app-backend This command will output details about the app-backend network. The of the output of this command should look similar to: [ { "Name": "foo", "Id": "a0349d78c8fd7c16f5940bdbaf1adec8d8399b8309b2e8a969bd4e...
Using docker-machine is the best method to install Docker on a machine. It will automatically apply the best security settings available, including generating a unique pair of SSL certificates for mutual authentication and SSH keys. To create a local machine using Virtualbox: docker-machine create...
Listing docker-machines will return the state, address and version of Docker of each docker machines. docker-machine ls Will print something like: NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS docker-machine-1 - ovh Running ...
Upgrading a docker machine implies a downtime and may require planing. To upgrade a docker machine, run: docker-machine upgrade docker-machine-name This command does not have options
docker save -o ubuntu.latest.tar ubuntu:latest This command will save the ubuntu:latest image as a tarball archive in the current directory with the name ubuntu.latest.tar. This tarball archive can then be moved to another host, for example using rsync, or archived in storage. Once the tarball h...
Docker is just a fancy way to run a process, not a virtual machine. Therefore, debugging a process "in a container" is also possible "on the host" by simply examining the running container process as a user with the appropriate permissions to inspect those processes on the host (...
docker-compose run service-name command If, for example, you wanted to run rake db:create in your web service, you'd use the following command: docker-compose run web rake db:create
Install Docker Engine. If you get a Permission denied error, Run sudo -i before the two commands below, then exit. Pull Docker Compose to /usr/local/bin/docker-compose. curl -L https://github.com/docker/compose/releases/download/1.7.1/docker-compose-`uname -s`-`uname -m` > /usr/loc...
Locally created images can be pushed to Docker Hub or any other docker repo host, known as a registry. Use docker login to sign in to an existing docker hub account. 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...
To get the IP address of a docker machine, you can do that with this command : docker-machine ip machine-name
Edit /etc/init/docker.conf and update the DOCKER_OPTS variable to the following: DOCKER_OPTS='-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock' Restart Docker deamon service docker restart Verify if Remote API is working curl -X GET http://localhost:4243/images/json
A very basic docker-compose.yml looks like this: version: '2' services: hello_world: image: ubuntu command: [/bin/echo, 'Hello world'] This file is making it so that there's a hello_world service, that's initialized from the ubuntu:latest image and that, when it's run, it just runs...
To run multiple processes e.g. an Apache web server together with an SSH daemon inside the same container you can use supervisord. Create your supervisord.conf configuration file like: [supervisord] nodaemon=true [program:sshd] command=/usr/sbin/sshd -D [program:apache2] command=/bin/bash...
.NET Core app should be published using dotnet publish FROM microsoft/dotnet:latest COPY bin/Debug/netcoreapp1.0/publish/ /root/ EXPOSE 5000 ENTRYPOINT dotnet /root/sampleapp.dll
This is an simple example to create a mysql server with docker 1.- create docker-compose.yml: Note: If you want to use same container for all your projects, you should create a PATH in your HOME_PATH. If you want to create it for every project you could create a docker directory in your project. ...
Linux running systemd, like Ubuntu 16.04, adding -H tcp://0.0.0.0:2375 to /etc/default/docker does not have the effect it used to. Instead, create a file called /etc/systemd/system/docker-tcp.socket to make docker available on a TCP socket on port 4243: [Unit] Description=Docker Socket for the AP...

Page 2 of 4