4 févr. 2016

[DOCKER] Commencer avec Docker sous Linux (ETAPE 1)

J'ai testé le tutoriel "Get Started with Docker for Linux" (source : https://docs.docker.com/linux/)

Ce tuto est destiné à toute personne intéressée pour en apprendre plus de Docker (ce qui est mon cas!)
Il sera a moitié en Anglais et mes commentaires en Français "rouge italique citation"

Commençons ...

This getting started is for non-technical users who are interested in learning about Docker. By following this getting started, you’ll learn fundamental Docker features by performing some simple tasks. 

  You’ll learn how to:
  • install Docker
  • run a software image in a container
  • browse for an image on Docker Hub
  • create your own image and run it in a container
  • create a Docker Hub account and an image repository
  • create an image of your own
  • push your image to Docker Hub for others to use
The getting started was user tested to reduce the chance of users having problems. For the best chance of success, follow the steps as written the first time before exploring on your own. It takes approximately 45 minutes to complete.
Make sure you understand…

This getting started uses Docker commands with a terminal window. You don’t need to be experienced using a command line, but you should be familiar with how to open one and type commands.
Il faut suivre scrupuleusement les étapes pour espérer que ça fonctionne, cela devrait durer 45 minutes. Pas besoin d'être un pro de la ligne de commande mais ça peut servir...
Installer Docker
Dans mon cas, je dispose d'une machine virtuelle 1Go de RAM, le système d'exploitation est Ubuntu 14.04.3 LTS
This installation procedure is written for users who are unfamiliar with package managers. If you are comfortable with package managers, prefer not to use wget, or have problems installing and want to troubleshoot, please use our apt and yum repositories instead for your installation.

1 - Log into your Ubuntu installation as a user with sudo privileges.
2 - Verify that you have wget installed.

Taper:
root@docker:~# which wget
/usr/bin/wget
If wget isn’t installed, install it after updating your manager:
Taper:
$ sudo apt-get update
$ sudo apt-get install wget
3 - Get the latest Docker package.
Taper:
$ wget -qO- https://get.docker.com/ | sh
The system prompts you for your sudo password. Then, it downloads and installs Docker and its dependencies.

Note: If your company is behind a filtering proxy, you may find that the apt-key command fails for the Docker repo during installation. To work around this, add the key directly using the following:


Penser à faire un export https_proxy="http://proxy:8080/" si vous êtes derrière un proxy ...
$ wget -qO- https://get.docker.com/gpg | sudo apt-key add -
4 - Verify docker is installed correctly.
Taper:
$ sudo docker run hello-world
sudo: unable to resolve host docker
Unable to find image 'hello-world:latest' locally
Pulling repository docker.io/library/hello-world
Error while pulling image: Get https://index.docker.io/v1/repositories/library/hello-
world/images: dial tcp: lookup index.docker.io: no such host
Dans mon cas ça ne s'est pas passer comme prévu car j'utilise un Proxy, pour résoudre ce problème. Suivre les instructions suivantes:
Editer /etc/default/docker
Taper:
$ sudo vim /etc/default/docker
ajouter les lignes suivantes:
export http_proxy="http://10.250.0.5:8080/"
export https_proxy="http://10.250.0.5:8080/"
export HTTP_PROXY="http://10.250.0.5:8080/"
export HTTPS_PROXY="http://10.250.0.5:8080/"

(10.250.0.5 à remplacer par votre proxy...)
Redémarrer le service docker
# service docker restart
docker stop/waiting
docker start/running, process 5072
Relancer la commande docker

root@docker:~# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b901d36b6f2f: Pull complete
0a6ba66e537a: Pull complete
Digest: sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
Status: Downloaded newer image for hello-world:latest

Hello from Docker.
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/userguide/

SOURCE: https://docs.docker.com/linux/step_one/




Aucun commentaire:

Enregistrer un commentaire