The docks were rail-served by both the Great Western Railway and the Midland Railway, later by the GWR and the LMS and ultimately by British Railways (BR).Neil Parkhouse, in one of his fantastic collections of colour photographs from the last decades of steam in Gloucestershire (British Railway History in Colour) focusses on the Midland lines serving the docks, specifically three lines in the area – the Tuffley Loop; the High Orchard Branch; and the Hempsted or New Docks Branch.  He covered the Western approaches to the docks in the first volume in his series. 
Wikipedia offers us the following volumes for researching the docks and the associated railways in Gloucester, although it is unable to provide links to the relevant texts: 
- Hugh Conway-Jones; Gloucester Docks: An illustrated history; Sutton & Gloucestershire County Library. 1984. 
- A Guide to Gloucester Docks; Sutton, 1988
- Michael Stimpson; The History of Gloucester Docks and its Associated Canals and Railways; West London Industrial Archaeological Society, Potters Bar, 1980.
Further research on the internet produces a number of sites which focus on the railways of the Docks in Gloucester:
- Gloucester Docks and the Sharpness Canal, Past and Present. 
- Gloucester Transport History: Railways in Gloucester and Churchdown After 1845. 
- Gloucester Transport History: Railways in Gloucester 
However, the first rail link to the docks was not a standard-gauge edge railway, but rather a plateway – The Gloucester and Cheltenham Tramroad. Its primary economic purpose was the transport of coal from Gloucester’s docks to the rapidly developing spa town of Cheltenham and the transport of building stone from quarries on nearby Leckhampton Hill to Cheltenham and Gloucester. 
”The tramroad was opened for mineral traffic on 2 July 1810. The line was a 3ft 6 in (1,067mm) gauge plateway, with cast iron plates on stone blocks. Wagons with plain wheels could run on the plates and were guided by an upstand on the plates. The route was single track, but passing places were provided at four to the mile, or more frequently. It appears that more passing places were added later, no doubt in response to higher traffic densities.” 
The picture below is a sketch map of the route of the tramroad produced by the GSIA (Gloucestershire Society for Industrial Archaeology) of which I am a member. (Membership of the society costs £9 per annum.) I have read through some of the internet links to the Cheltenham & Gloucester Tramroad and I have undertaken further research into the history of the line. That research has resulted in the drafting of a number of articles about the Tramroad:
The tramroad/plateway was horse-powered and only briefly flirted with the use of steam-power.  But the use of horses did not stop with the construction of what we today would see as more conventional railways. After the Midland Railway had built its lines into the Dock complex, horses were still vital to the operation of the railways in the docks. Hugh Conway-Jones explains:
“Horses were used on the dock railways to distribute incoming wagons, marshall outgoing wagons and make short transfers between quay and warehouse etc. These movements could be quite time consuming as many of the lines along the quays were only linked to the main system by small turn-tables that could only take one wagon at a time. The horses knew exactly where to stop to position a wagon correctly on a turntable, which was then rotated by pushing on an extending arm. Sometimes a horse was hitched up to the arm to get the turntable moving, but care was required not to exert too much force or the wagon could swing round out of control. The horses also knew that it was worth stopping outside the black shed beside the Great Western Warehouse, as this was where the lump sugar was stored and some body would usually give them a lump or two. Locomotives were used for transfers between the different parts of the docks, and as some of the bends were rather sharp, the Midland Railway had a special type of tank locomotive with a very short wheelbase.” [35: p123]
The tramroad made, in its time, a dramatic contribution to the economic life of Cheltenham, Gloucester and its Docks. It was unable, however, to compete with the more modern railways and gradually became less and less significant in the life of the Docks and nearby conurbations. Eventually it closed in 1861. Much of the line has disappeared under development in Cheltenham and Gloucester. There are things to find which relate to the old tramway and details can be found in the series of articles above. Information on some of the remains can also be found at http://www.gsia.org.uk. 
It was the middle of the 19th century when branches from the Midland Railway were laid to serve to docks in Gloucester. The GWR also laid tracks to serve the docks. These became a better option than the waterways for carrying imports into the Midlands and they eclipsed the tramroad for local supplies to Cheltenham. The Midland sidings cut the tramroad access to the northern part of the docks and to the quay further north along the River Severn
The Midland Railway completed their branch to Bakers Quay and the east side of the docks in 1848. That branch also served the timber yards established along the canal banks to the south. “Locomotives moved wagons to and from the main line, but most movements around the docks area, as we have already noted, were done by horses, particularly as there were a number of turntables needed to negotiate sharp corners around existing buildings.” 
The Great Western Railway completed their branch to Llanthony Quay and the west side of the docks just a few years later – around 1853. Broad gauge lines were laid at this time but soon these were converted to mixed-gauge. Hugh Conway-Jones says that, “it had been hoped that the GWR line would provide a ready supply of coal from the Forest of Dean for export, but most masters preferred to load coal at one of the South Wales ports.” 
The different railway routes at the docks will be covered in subsequent articles. It is interesting to note that because of the differing access arrangements, the sidings on each side of the docks had very different characteristics. The sidings from the Midland Railway had to find their way through relatively built up areas to reach the dockside. Those from the Great Western Railway crossed open fields and the River Severn before they formed a fan of sidings close to the docks with some extensions southwards down the west side of the docks.
Aerial Images of Gloucester Docks
These aerial images of the docks are available on the Historic England website, ‘Britain From Above’. They show the docks at work in the period between about 1920 and 1950.
Image No. EPW024154 – Gloucester prison and the docks, Gloucester, 1928. The River Severn can be seen curving away to the right of the image. The Canal to Sharpness heads away to the South at the top of the image. Image No. EPW024161 – Gloucester Docks, 1928. It is interesting to note the presence of open fields on the far side of the River Severn! The Main Basin is shown in the centre of the image and the canal running from it to the bottom of the image was the access for shipping into the Victoria Dock. Image No. EPW024164 – Victoria Dock, Southgate Street and environs, Gloucester, 1928. The Main Basin is just off the photograph to the right. The railway sidings in the foreground were originally Midland Railway Sidings and those in the top right corner of the picture were GWR sidings. Image No. EPW024166 – The Docks and environs, Gloucester, 1928. Both Victoria Dock and the Main Basin are centre stage in this image. The River Severn can be seen in the top right with green fields beyond. Top-centre are the GWR sidings with a bridge access across the River Severn, top right. Image No. EPW037837 – GWR Railway sidings next to Llanthony Priory and surroundings, Gloucester, 1932. The River Severn and one of its locks are in the foreground. 
- The Docks Conservation Area (Conservation Area No. 3) Appraisal & Management Proposals. Gloucester City Council, Gloucester, 2007, accessed on 9th April 2020, quoted in reference  below.
- https://en.m.wikipedia.org/wiki/Gloucester_Docks, accessed on 9th April 2020.
- One of several museums and attractions operated by the Canal & River Trust, the successor to The Waterways Trust, the Gloucester Waterways Museum is housed in the old Llanthony Warehouse in the heart of what once was the bustling Gloucester Docks. 
- The Soldiers of Gloucestershire Museum is also located in Gloucester’s Historic Docks. It reopened in April 2014 after a significant Heritage Lottery funded refurbishment. It is a place to discover the lives of Gloucestershire soldiers over the last 300 years. The story begins in 1694, travels through the Napoleonic Wars, the Age of Empire, Worlds Wars, Korea and right up to modern day conflicts. 
- https://canalrivertrust.org.uk/places-to-visit-the-national-waterways-museum-gloucester, accessed on 9th April 2020.
- https://www.soldiersofglos.com, accessed on 9th April 2020.
- The Gloucester & Sharpness Canal was once the broadest and deepest in the world. Even today, it stands out from other navigations because of its sheer scale and impressive engineering. 
- https://canalrivertrust.org.uk/enjoy-the-waterways/canal-and-river-network/gloucester-and-sharpness-canal, accessed on 9th April 2020.
- Neil Parkhouse; British Railway History in Colour: Volume 4A – Gloucester Midland Lines Part 2 : South, Eastgate to Stroud & Nailsworth; Lightmoor Press, Lydney, Gloucestershire, 2019; cf. http://lightmoor.co.uk/books/gloucester-midland-lines-part-2-south/L8665, accessed on 18th April 2020.
- https://en.wikipedia.org/wiki/Bibliography_of_the_City_of_Gloucester#Gloucester_Docks, accessed on 18th April 2020.
- https://www.gloucesterdocks.me.uk/gloucester/railways.htm, accessed on 18th April 2020.
- https://www.gloucesterdocks.me.uk/gloucester/docks.htm, accessed on 18th April 2020.
- https://www.gloucesterdocks.me.uk/gloucester/dockssouth.htm, accessed on 18th April 2020.
- https://www.gloucesterdocks.me.uk/studies/highorchard.htm, accessed on 18th April 2020.
- https://www.gloucesterdocks.me.uk/gloucester/details/glodetailsnorth.htm, accessed on 18th April 2020.
- https://en.wikipedia.org/wiki/Gloucester_and_Cheltenham_Tramroad, accessed on 18th April 2020.
- https://www.geograph.org.uk/photo/4166438, accessed on 18th April 2020.
- https://www.british-history.ac.uk/vch/glos/vol4/pp251-258, accessed on 18th April 2020.
- https://llanthonysecunda.org/entry/1951-map-of-gloucester-docks, accessed on 18th April 2020.
- https://glostransporthistory.visit-gloucestershire.co.uk/Railgloschur2.htm, accessed on 18th April 2020.
- https://sites.google.com/site/gloucestershirerailwaymemories/home/a-new-way-and-works/gloucester-dock-branch-sidings-and-llantony, acessed on 18th April 2020.
- https://www.gloucestershirelive.co.uk/whats-on/shopping/gallery/take-look-gloucester-before-gloucester-2874249, accessed on 18th April 2020.
- Hugh Conway-Jones; Gloucester Docks: An Historical Guide; Lightmoor Press, Lydney, Glocestershire, 2009.
- https://commons.wikimedia.org/wiki/File:Midland_Railway_Crane,_Gloucester_Docks._-_panoramio.jpg, accessed on 18th April 2020.
- https://www.gloucestershirelive.co.uk/news/gloucester-news/gallery/remnants-gloucesters-industrial-revolution-littered-3221228,, accessed on 18th April 2020.
- https://www.geograph.org.uk/photo/70782, accessed on 18th April 2020.
- https://britainfromabove.org.uk/en/image/EPW024154, accessed on 18th April 2020.
- https://britainfromabove.org.uk/en/image/EPW024161, accessed on 18th April 2020.
- https://britainfromabove.org.uk/en/image/EPW024164, accessed on 18th April 2020.
- https://britainfromabove.org.uk/en/image/EPW024166, accessed on 18th April 2020.
- https://britainfromabove.org.uk/en/image/EPW037837, accessed on 18th April 2020.
- https://www.gsia.org.uk/gct/gsia-tramroad-history.pdf, accessed on 18th April 2020.
- https://rogerfarnworth.com/2020/04/23/the-cheltenham-and-gloucester-tramroad-part-1, published on 24th April 2020.
- https://glostransporthistory.visit-gloucestershire.co.uk/First%20Railways%20in%20Gloucester.htm, accessed on 24th April 2020.
- Hugh Conway-Jones; Gloucester Docks: An Illustrated History; in the County Library Series, Allan Sutton, Gloucester and Gloucestershire County Libraries, 1984.
- https://rogerfarnworth.com/2020/05/02/the-gloucester-and-cheltenham-tramroad-part-2, published on 2nd May 2020.
- https://rogerfarnworth.com/2020/05/06/the-gloucester-and-cheltenham-tramroad-part-3, published on 6th May 2020.
- https://rogerfarnworth.com/2020/05/08/the-gloucester-and-cheltenham-tramroad-part-4, published on 8th May 2020.
- D.E. Bick; ‘The Gloucester & Cheltenham Railway and the Leckhampton Quarry Tramroads’; The Oakwood Press, 1968.
- https://www.gsia.org.uk/membership.php, accessed on 30th April 2020.
- Neil Parkhouse; British Railway History in Colour: Volume 1 – West Gloucester and Wye Valley Lines, 2nd Edition, Lightmoor Press, Lydney, Gloucestershire.