Servicios
Definir archivo opciones contenedores de servicio
docker-compose.yml editado
Versiones de archivo: https://docs.docker.com/compose/compose-file/
# editar contenido de docker-compose.yml en arbol de identaciones
version: "3.7"
services:
nginx:
image: nginx
ports:
- "80:80"
# a nivel del archivo en la terminal levantar el servicio usando el archivo
cd servicios
docker-compose up
# salida
Creating network "servicios_default" with the default driver
Creating servicios_nginx_1 ... done
Attaching to servicios_nginx_1
# log al acceder desde el navegador
nginx_1 | 172.23.0.1 - - [13/Mar/2020:10:55:07 +0000] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36" "-"
nginx_1 | 2020/03/13 10:55:08 [error] 6#6: *1 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 172.23.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost", referrer: "http://localhost/"
nginx_1 | 172.23.0.1 - - [13/Mar/2020:10:55:08 +0000] "GET /favicon.ico HTTP/1.1" 404 555 "http://localhost/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36" "-"
# salida con Ctrl+C, ver ayuda
^CGracefully stopping... (press Ctrl+C again to force)
Stopping servicios_nginx_1 ... done
docker-compose --help
...
build Build or rebuild services
bundle Generate a Docker bundle from the Compose file
config Validate and view the Compose file
create Create services
down Stop and remove containers, networks, images, and volumes
events Receive real time events from containers
exec Execute a command in a running container
help Get help on a command
images List images
kill Kill containers
logs View output from containers
pause Pause services
port Print the public port for a port binding
ps List containers
...
start Start services
stop Stop services
top Display the running processes
unpause Unpause services
up Create and start containers
version Show the Docker-Compose version information
# ver ayuda, comando up
docker-compose up --help
...
-d, --detach Detached mode: Run containers in the background,
print new container names. Incompatible with
--abort-on-container-exit.
--no-color Produce monochrome output.
--quiet-pull Pull without printing progress information
--no-deps Don't start linked services.
--force-recreate Recreate containers even if their configuration
and image haven't changed.
...
in the Compose file.
--exit-code-from SERVICE Return the exit code of the selected service
container. Implies --abort-on-container-exit.
--scale SERVICE=NUM Scale SERVICE to NUM instances. Overrides the
`scale` setting in the Compose file if present.Eliminar contenedores de servicio y configuraciones
Personalizar nombre servicio contenedor
Agregar servicio en contenedor
Última actualización
¿Te fue útil?