You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem: Configuration is done via a single YAML file and a server restart is required in order for any changes to take effect. Trying to start the server with an invalid config file will result in an error.
Solution: Create a Bash script for install and rebuild.
1. Docker must be installed. (Confirmed works with 27.2.02)
2. Create a new files "install.sh" and "glance.yml" in the same folder.
3. Use the below code and the linked preconfigured page
4. Run ./install.sh
Explanation: Container Check and Removal : The script checks if a container with the name glance exists, stops it, and removes it if
necessary.
Container Creation: It then creates and starts a new Docker container for glance, mapping port 8080 of the host to the same port in the container. Additional volumes are mounted to provide configuration files and timezone settings.
Host IP Address Determination: The script uses Docker's internal networking capabilities by calling docker inspect to get the IP address assigned to the container on startup. If this method fails (which should be rare if Docker is properly configured), it falls back to using a Linux command (ip route get 1 | awk '{print $7}') to obtain the external IP address.
Output: Finally, the script outputs the URL that can be used to access the service, based on the determined host IP address and the mapped port.
#!/bin/bash# Define the service name
SERVICE_NAME="glance"# Function to check if the container existscontainer_exists() {
docker ps -a --filter "name=^/$SERVICE_NAME$"> /dev/null 2>&1
}
# Check if the container existsif container_exists;then# Stop and remove the existing containerecho"Stopping and removing existing $SERVICE_NAME container..."
docker stop $SERVICE_NAME> /dev/null
docker rm $SERVICE_NAME> /dev/null
fi# Create and start a new container with port mappingecho"Creating and starting $SERVICE_NAME container..."
docker run -d \
--name $SERVICE_NAME \
-p 8080:8080 \
-v ./glance.yml:/app/glance.yml \
-v /etc/timezone:/etc/timezone:ro \
-v /etc/localtime:/etc/localtime:ro \
glanceapp/glance > /dev/null
echo"$SERVICE_NAME container has been recreated."# Display the URL to navigate to the HTTP site using the host's external IP and port number
HOST_IP=$(ip route get 1 | awk '{print $7}')# Linux command to get external IPecho"You can access the service at: http://$HOST_IP:8080"
The text was updated successfully, but these errors were encountered:
Hey, I'm not sure what the issue is here as you seem to have also provided a solution? Would this maybe benefit from being converted to a discussion instead?
Problem: Configuration is done via a single YAML file and a server restart is required in order for any changes to take effect. Trying to start the server with an invalid config file will result in an error.
Solution: Create a Bash script for install and rebuild.
1. Docker must be installed. (Confirmed works with 27.2.02)
2. Create a new files "install.sh" and "glance.yml" in the same folder.
3. Use the below code and the linked preconfigured page
4. Run ./install.sh
Explanation: Container Check and Removal : The script checks if a container with the name glance exists, stops it, and removes it if
necessary.
Container Creation: It then creates and starts a new Docker container for glance, mapping port 8080 of the host to the same port in the container. Additional volumes are mounted to provide configuration files and timezone settings.
Host IP Address Determination: The script uses Docker's internal networking capabilities by calling docker inspect to get the IP address assigned to the container on startup. If this method fails (which should be rare if Docker is properly configured), it falls back to using a Linux command (ip route get 1 | awk '{print $7}') to obtain the external IP address.
Output: Finally, the script outputs the URL that can be used to access the service, based on the determined host IP address and the mapped port.
The text was updated successfully, but these errors were encountered: