Improve docker container management

- Simplify tagging.
- Test removal of old container.
This commit is contained in:
Uggla 2016-01-18 12:30:07 +01:00
parent df2c027823
commit dd66a15e02
3 changed files with 7 additions and 7 deletions

View File

@ -3,4 +3,3 @@
# Build and tag images # Build and tag images
docker rmi redfish-simulator docker rmi redfish-simulator
docker build -t "redfish-simulator" . docker build -t "redfish-simulator" .
docker tag -f redfish-simulator:latest localhost:5000/redfish-simulator

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
function start_apache { function start_apache {
[ -f "/run/apache2/apache2.pid" ] && rm "/run/apache2/apache2.pid" [ -f "/run/apache2/apache2.pid" ] && rm -f "/run/apache2/apache2.pid"
echo "Launching apache2 in foreground with /usr/sbin/apache2ctl -DFOREGROUND -k start" echo "Launching apache2 in foreground with /usr/sbin/apache2ctl -DFOREGROUND -k start"
/usr/sbin/apache2ctl -DFOREGROUND -k start /usr/sbin/apache2ctl -DFOREGROUND -k start
} }

View File

@ -1,8 +1,9 @@
#!/bin/bash #!/bin/bash
# Build the docker container first docker ps -a | grep -q "redfish-simulator:latest"
docker build -t localhost:5000/redfish-simulator:latest . if [ "$?" -eq 0 ]; then
# Th -p option needs to be after the run command. No warning is given if before but doesn't work docker rm "redfish-simulator"
docker rm "redfish-simulator" fi
docker run -d -p 8000:80 --name "redfish-simulator" localhost:5000/redfish-simulator:latest # The -p option needs to be after the run command. No warning is given if before but doesn't work
docker run -d -p 8000:80 --name "redfish-simulator" redfish-simulator:latest
echo "Launch your browser and load http://localhost:8000/redfish/v1" echo "Launch your browser and load http://localhost:8000/redfish/v1"