Skip to content

Instantly share code, notes, and snippets.

@scottnixonjr
Created July 27, 2020 21:43
Show Gist options
  • Save scottnixonjr/1a37ec4e94a75f3759f9bfba5427215e to your computer and use it in GitHub Desktop.
Save scottnixonjr/1a37ec4e94a75f3759f9bfba5427215e to your computer and use it in GitHub Desktop.
# Build container
docker build -t <image-name> .
# GET the WEB instance and access CLI.
docker ps | grep <container-name-id> | cut -c1-12 | read CON_ID; docker exec -it $CON_ID /bin/sh
docker ps | grep <container-name-id> | cut -c1-12 | read CON_ID; docker exec -it $CON_ID /bin/sh
# Run container
docker run -it -d <container-name-id> bin/bash
# Enter running container
docker exec -it <container-name-id> /bin/bash
# Combine both commands above.
docker run -it --rm -d <container-name-id> /bin/sh | read CON_ID; docker exec -it $CON_ID /bin/sh
# Extract a tar file into a directory on a Container
docker cp - <container-name-id>:/ < test.tar
# Stop continers
docker container stop <container-name-id>
# Rebuild an individual Docker Compose service
docker-compose up -d --no-deps --build <service_name>
# Show docker-compose configuration with vars
docker-compose config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment