echo"* The container will be built using the existing docker image $library_image"
fi
cat <<END
How to use the image:
# docker options:
# -i: is interactive (attach STDIN).
# -d: is daemon mode.
sudo docker image ls
# ^ See what images are installed (one image can be used for many containers).
sudo docker rmi $library_image
# ^ Remove a docker image (This is necessary after updating the unversioned Docker image to avoid cached RUN commands from doing nothing when the script after RUN changes).
sudo docker image prune
# ^ Prune unused images (For this to do anything, first delete containers using the image).
sudo docker ps -a
# ^ List containers and show NAMES (The name is necessary for certain subcommands such as exec which operate on a running container).
sudo docker start $container_name
# ^ Start a container. This will merely run $run_all_build_commands_script again since that is the container's main process.
sudo docker attach $container_name
# ^ attach the current terminal to a running container.
sudo docker run $container_name
# ^ "run" is merely a combination of "create" and "start"
sudo docker -w $contained_repoexec$container_name ls -l $contained_repos
# ^ Execute a command in a running container (exec shows an error if the container isn't running).
# This will not work if the run/start command that started the container isn't a command that keeps it open (runs indefinitely)!
# That is because the Dockerfile ENTRYPOINT (or if customized on a per-container basis, the "docker run" command) specifies the entry point (permanently) for the container.
# If you need a container that has changes after $run_all_build_commands_script runs or runs a different command, you must use the "commit" subcommand to create a new image.
# w: working directory
sudo docker stop $container_name
# ^ Stop a container by name (See <https://www.tecmint.com/name-docker-containers/>)
# You must use the container name (as determined using the "ps" subcommand), not the image name.
sudo docker container run -it $library_image /bin/bash
# ^ Run an interactive terminal (Type 'exit' to exit)
# (based on <https://phoenixnap.com/kb/docker-run-command-with-examples>)
# ^ ONLY works with container_name not library_image
@ -272,6 +214,66 @@ echo
# fi
# ^ Build the server as a separate step instead (see further up)
cat <<END
How to use the image:
# docker options:
# -i: is interactive (attach STDIN).
# -d: is daemon mode.
sudo docker image ls
# ^ See what images are installed (one image can be used for many containers).
sudo docker rmi $library_image
# ^ Remove a docker image (This is necessary after updating the unversioned Docker image to avoid cached RUN commands from doing nothing when the script after RUN changes).
sudo docker image prune
# ^ Prune unused images (For this to do anything, first delete containers using the image).
sudo docker ps -a
# ^ List containers and show NAMES (The name is necessary for certain subcommands such as exec which operate on a running container).
sudo docker start $container_name
# ^ Start a container. This will merely run $run_all_build_commands_script again since that is the container's main process.
sudo docker attach $container_name
# ^ attach the current terminal to a running container.
sudo docker run $container_name
# ^ "run" is merely a combination of "create" and "start"
sudo docker -w $contained_repoexec$container_name ls -l $contained_repos
# ^ Execute a command in a running container (exec shows an error if the container isn't running).
# This will not work if the run/start command that started the container isn't a command that keeps it open (runs indefinitely)!
# That is because the Dockerfile ENTRYPOINT (or if customized on a per-container basis, the "docker run" command) specifies the entry point (permanently) for the container.
# If you need a container that has changes after $run_all_build_commands_script runs or runs a different command, you must use the "commit" subcommand to create a new image.
# w: working directory
sudo docker stop $container_name
# ^ Stop a container by name (See <https://www.tecmint.com/name-docker-containers/>)
# You must use the container name (as determined using the "ps" subcommand), not the image name.
sudo docker container run -it $library_image /bin/bash
# ^ Run an interactive terminal (Type 'exit' to exit)
# (based on <https://phoenixnap.com/kb/docker-run-command-with-examples>)