title: Creating a Training Job using sagemaker estimator gives me "error: unrecognized arguments: train"
body: <p>I am using a docker image which have all required files and then push it to aws ecr where i can use that image to pass to estimator. I have added the train.py file as entrypoint in dockerfile.</p>
  <pre><code>ENTRYPOINT [&quot;python3&quot;, &quot;-m&quot;,&quot;train&quot;]
  </code></pre>
  <p>This works as required in local with <code>docker run -it image</code> <strong>but when running training job i get the error.</strong></p>
  <pre><code>Training - Training image download completed. Training in progress...usage: train.py [-h] [--epochs EPOCHS] [--learning_rate LEARNING_RATE]
                  [--max_sequence_length MAX_SEQUENCE_LENGTH]
                  [--train_batch_size TRAIN_BATCH_SIZE]
                  [--valid_batch_size VALID_BATCH_SIZE]
  train.py: error: unrecognized arguments: train
  </code></pre>
  <p>The training job using sagemaker estimator:</p>
  <pre><code>estimator = sagemaker.estimator.Estimator(image, # docker image
                                            role,
                                            train_instance_count=1, 
                                            train_instance_type='ml.p2.xlarge', 
                                            output_path=output_path, 
                                            hyperparameters=hyperparameters,
                                            sagemaker_session=session
                                           )
  </code></pre>
  <p>Train.py main fun():</p>
  <pre><code>if __name__ == &quot;__main__&quot;:
      parser = argparse.ArgumentParser()
      parser.add_argument('--epochs', type=int, default=2)
      parser.add_argument('--learning_rate', type=float, default=2e-5)
      parser.add_argument('--max_sequence_length', type=int, default=512)
      parser.add_argument('--train_batch_size', type=int, default=12)
      parser.add_argument('--valid_batch_size', type=int, default=8)
      # SageMaker environment variables.
      #parser.add_argument('--hosts', type=str, default=os.environ['SM_HOSTS'])
      #parser.add_argument('--current_host', type=str, default=os.environ['SM_CURRENT_HOST'])
      # Parse command-line args and run main.
      args = parser.parse_args()
      # Get SageMaker host information from runtime environment variables
      #sm_hosts = json.loads(args.hosts)
      #sm_current_host = args.current_host
      train(args)
  </code></pre>
  <p>From <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-training-algo-dockerfile.html" rel="nofollow noreferrer">sagemaker doc</a> i was able to find that image in training job runs as <code>docker run image train</code> and when i tried to the same in local i got the same error.</p>