Diferencia entre revisiones de «Creando mi propia imagen»

De Wiki de EGC
Saltar a: navegación, buscar
Línea 9: Línea 9:
  
 
<syntaxhighlight lang="sh">
 
<syntaxhighlight lang="sh">
# apt-get update
+
root@d66f7a3268e6:/# apt-get update
# apt-get install apache2
+
root@d66f7a3268e6:/# apt-get install apache2
 
apt-get install apache2
 
apt-get install apache2
 
Reading package lists... Done
 
Reading package lists... Done
Línea 16: Línea 16:
 
Reading state information... Done
 
Reading state information... Done
 
The following additional packages will be installed:
 
The following additional packages will be installed:
   apache2-bin apache2-data apache2-utils file ifupdown iproute2
+
   apache2-bin apache2-data apache2-utils ...
  isc-dhcp-client isc-dhcp-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3
 
  libaprutil1-ldap libasn1-8-heimdal libatm1 libdns-export162 libexpat1
 
  libffi6 libgdbm3 libgmp10 libgnutls30 libgssapi3-heimdal libhcrypto4-heimdal
 
  libheimbase1-heimdal libheimntlm0-heimdal libhogweed4 libhx509-5-heimdal
 
  libicu55 libidn11 libisc-export160 libkrb5-26-heimdal libldap-2.4-2
 
  liblua5.1-0 libmagic1 libmnl0 libnettle6 libp11-kit0 libperl5.22
 
  libroken18-heimdal libsasl2-2 libsasl2-modules libsasl2-modules-db
 
  libsqlite3-0 libssl1.0.0 libtasn1-6 libwind0-heimdal libxml2 libxtables11
 
  mime-support netbase openssl perl perl-modules-5.22 rename sgml-base
 
  ssl-cert xml-core
 
 
The following NEW packages will be installed:
 
The following NEW packages will be installed:
   apache2 apache2-bin apache2-data apache2-utils file ifupdown iproute2
+
   apache2 apache2-bin apache2-data apache2-utils ...
  isc-dhcp-client isc-dhcp-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3
 
  libaprutil1-ldap libasn1-8-heimdal libatm1 libdns-export162 libexpat1
 
  libffi6 libgdbm3 libgmp10 libgnutls30 libgssapi3-heimdal libhcrypto4-heimdal
 
  libheimbase1-heimdal libheimntlm0-heimdal libhogweed4 libhx509-5-heimdal
 
  libicu55 libidn11 libisc-export160 libkrb5-26-heimdal libldap-2.4-2
 
  liblua5.1-0 libmagic1 libmnl0 libnettle6 libp11-kit0 libperl5.22
 
  libroken18-heimdal libsasl2-2 libsasl2-modules libsasl2-modules-db
 
  libsqlite3-0 libssl1.0.0 libtasn1-6 libwind0-heimdal libxml2 libxtables11
 
  mime-support netbase openssl perl perl-modules-5.22 rename sgml-base
 
  ssl-cert xml-core
 
 
0 upgraded, 57 newly installed, 0 to remove and 4 not upgraded.
 
0 upgraded, 57 newly installed, 0 to remove and 4 not upgraded.
 
Need to get 22.6 MB/22.6 MB of archives.
 
Need to get 22.6 MB/22.6 MB of archives.
 
After this operation, 102 MB of additional disk space will be used.
 
After this operation, 102 MB of additional disk space will be used.
 
Do you want to continue? [Y/n]  
 
Do you want to continue? [Y/n]  
 +
...
 +
root@d66f7a3268e6:/#
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Línea 48: Línea 30:
  
 
<syntaxhighlight lang="sh">
 
<syntaxhighlight lang="sh">
# exit
+
root@d66f7a3268e6:/# exit
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
<syntaxhighlight lang="sh">
 
<syntaxhighlight lang="sh">
# docker commit -m "Imagen de ubuntu con apache2" -a "profe" XXXXXX ubuntu/apache2
+
# docker commit -m "Imagen de ubuntu con apache2" -a "profe" d66f7a3268e6 ubuntu/apache2
 
</syntaxhighlight>
 
</syntaxhighlight>

Revisión del 15:40 26 oct 2017

Podemos modificar una imagen existente y guardarla con un nombre diferente:

# docker run -it ubuntu bash
root@d66f7a3268e6:/#

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.

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:/#

Escribo 'Y' y pulso enter para comenzar la instalacion del servidor web apache2.

root@d66f7a3268e6:/# exit
# docker commit -m "Imagen de ubuntu con apache2" -a "profe" d66f7a3268e6 ubuntu/apache2