|
|
Línea 1: |
Línea 1: |
− | Podemos modificar una imagen existente y guardarla con un nombre diferente:
| |
| | | |
− | <syntaxhighlight lang="sh">
| |
− | # docker run -it ubuntu bash
| |
− | root@d66f7a3268e6:/#
| |
− | </syntaxhighlight>
| |
− |
| |
− | Fijaros en que el prompt del interprete de ordenes ha cambiado e indica el numero que identifica de manera unica al contenedor que hemos lanzado. Este numero cambia para cada nueva instancia que lanzamos.
| |
− |
| |
− | <syntaxhighlight lang="sh">
| |
− | root@d66f7a3268e6:/# apt-get update
| |
− | root@d66f7a3268e6:/# apt-get install apache2
| |
− | apt-get install apache2
| |
− | Reading package lists... Done
| |
− | Building dependency tree
| |
− | Reading state information... Done
| |
− | The following additional packages will be installed:
| |
− | apache2-bin apache2-data apache2-utils ...
| |
− | The following NEW packages will be installed:
| |
− | apache2 apache2-bin apache2-data apache2-utils ...
| |
− | 0 upgraded, 57 newly installed, 0 to remove and 4 not upgraded.
| |
− | Need to get 22.6 MB/22.6 MB of archives.
| |
− | After this operation, 102 MB of additional disk space will be used.
| |
− | Do you want to continue? [Y/n]
| |
− | ...
| |
− | root@d66f7a3268e6:/#
| |
− | </syntaxhighlight>
| |
− |
| |
− | Escribo 'Y' y pulso enter para comenzar la instalacion del servidor web apache2.
| |
− |
| |
− | <syntaxhighlight lang="sh">
| |
− | root@d66f7a3268e6:/# exit
| |
− | </syntaxhighlight>
| |
− |
| |
− | <syntaxhighlight lang="sh">
| |
− | # docker commit -m "Imagen de ubuntu con apache2" -a "profe" d66f7a3268e6 ubuntu/apache2
| |
− | sha256:b68ef77405104a6ea2de6fde986a519a2fc9710b26d9ae8ec2553f5050c51fd3
| |
− | </syntaxhighlight>
| |
− |
| |
− | <syntaxhighlight lang="sh">
| |
− | # docker images
| |
− | REPOSITORY TAG IMAGE ID CREATED SIZE
| |
− | ubuntu/apache2 latest b68ef7740510 36 seconds ago 260MB
| |
− | </syntaxhighlight>
| |
− |
| |
− | <syntaxhighlight lang="sh">
| |
− | # docker run -it -p 8888:80 ubuntu/apache2
| |
− | # service apache2 start
| |
− | * Starting Apache httpd web server apache2 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
| |
− | *
| |
− | </syntaxhighlight>
| |
− |
| |
− | Y ahora si abro un navegador web al localhost al puerto 8888, me aparece la pagina que indica que apache esta funcionando correctamente.
| |