Skip to main content
Glama

service_create_from_image

Create a Railway service from a Docker image to deploy custom databases, pre-built containers, or specific image versions.

Instructions

[API] Create a new service from a Docker image

⚡️ Best for: ✓ Custom database deployments ✓ Pre-built container deployments ✓ Specific version requirements

⚠️ Not for: × Standard database deployments (use database_deploy) × GitHub repository deployments (use service_create_from_repo) × Services needing build process

→ Prerequisites: project_list

→ Alternatives: database_deploy, service_create_from_repo

→ Next steps: variable_set, service_update, tcp_proxy_create

→ Related: volume_create, deployment_trigger

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesID of the project to create the service in
imageYesDocker image to use (e.g., 'postgres:13-alpine')
nameNoOptional custom name for the service

Implementation Reference

  • MCP tool handler function that executes the tool logic by calling serviceService.createServiceFromImage(projectId, image, name).
    async ({ projectId, image, name }) => { return serviceService.createServiceFromImage(projectId, image, name); }
  • Zod input schema defining parameters for the service_create_from_image tool: projectId, image, and optional name.
    { projectId: z.string().describe("ID of the project to create the service in"), image: z.string().describe("Docker image to use (e.g., 'postgres:13-alpine')"), name: z.string().optional().describe("Optional custom name for the service") },
  • Registration function that collects and registers all tools to the MCP server, including serviceTools which defines service_create_from_image.
    export function registerAllTools(server: McpServer) { // Collect all tools const allTools = [ ...databaseTools, ...deploymentTools, ...domainTools, ...projectTools, ...serviceTools, ...tcpProxyTools, ...variableTools, ...configTools, ...volumeTools, ...templateTools, ] as Tool[]; // Register each tool with the server allTools.forEach((tool) => { server.tool( ...tool ); }); }
  • Helper method in ServiceService class that implements the core logic for creating a service from a Docker image using the Railway client API.
    async createServiceFromImage(projectId: string, image: string, name?: string) { try { const service = await this.client.services.createService({ projectId, name, source: { image, } }); return createSuccessResponse({ text: `Created new service "${service.name}" (ID: ${service.id}) from Docker image "${image}"`, data: service }); } catch (error) { return createErrorResponse(`Error creating service: ${formatError(error)}`); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/epitaphe360/railway-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server